onconnect bug fix
This commit is contained in:
@@ -4,7 +4,7 @@ A Domoticz plugin to manage Tuya Smart Plug
|
|||||||
|
|
||||||
## ONLY TESTED FOR Raspberry Pi
|
## ONLY TESTED FOR Raspberry Pi
|
||||||
|
|
||||||
With Python version 3.5 & Domoticz version 4.9999 (beta)
|
With Python version 3.5 & Domoticz version 4.9700 (stable) and 4.9999 (beta)
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
||||||
"""
|
"""
|
||||||
<plugin key="tixi_tuya_smartplug_plugin" name="Tuya SmartPlug" author="tixi" version="2.0.1" externallink=" https://github.com/tixi/Domoticz-Tuya-SmartPlug-Plugin">
|
<plugin key="tixi_tuya_smartplug_plugin" name="Tuya SmartPlug" author="tixi" version="2.0.2" externallink=" https://github.com/tixi/Domoticz-Tuya-SmartPlug-Plugin">
|
||||||
<params>
|
<params>
|
||||||
<param field="Address" label="IP address" width="200px" required="true"/>
|
<param field="Address" label="IP address" width="200px" required="true"/>
|
||||||
<param field="Mode1" label="DevID" width="200px" required="true"/>
|
<param field="Mode1" label="DevID" width="200px" required="true"/>
|
||||||
@@ -97,12 +97,14 @@ class BasePlugin:
|
|||||||
if(self.__last_cmd != None):
|
if(self.__last_cmd != None):
|
||||||
self.__command_to_execute(self.__last_cmd)
|
self.__command_to_execute(self.__last_cmd)
|
||||||
else:
|
else:
|
||||||
|
Domoticz.Debug("OnConnect Error Status: " + str(Status))
|
||||||
|
if(Status==113):#no route to host error (skip to avoid intempestive connect call)
|
||||||
|
return
|
||||||
if(self.__connection.Connected()):
|
if(self.__connection.Connected()):
|
||||||
self.__connection.Disconnect()
|
self.__connection.Disconnect()
|
||||||
|
if(not self.__connection.Connecting()):
|
||||||
self.__connection.Connect()
|
self.__connection.Connect()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __extract_status(self, Data):
|
def __extract_status(self, Data):
|
||||||
""" Returns a tuple (bool,bool)
|
""" Returns a tuple (bool,bool)
|
||||||
first: set to True if an error occur and False otherwise
|
first: set to True if an error occur and False otherwise
|
||||||
|
|||||||
Reference in New Issue
Block a user