From e33229af3528021872ed6182616350621eefa1ff Mon Sep 17 00:00:00 2001 From: tixi Date: Tue, 9 Oct 2018 15:59:00 +0200 Subject: [PATCH] onconnect bug fix --- README.md | 2 +- plugin.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d4db724..85546a4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A Domoticz plugin to manage Tuya Smart Plug ## 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 diff --git a/plugin.py b/plugin.py index d3494ff..e2af09b 100644 --- a/plugin.py +++ b/plugin.py @@ -26,7 +26,7 @@ ######################################################################################## """ - + @@ -97,12 +97,14 @@ class BasePlugin: if(self.__last_cmd != None): self.__command_to_execute(self.__last_cmd) 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()): self.__connection.Disconnect() - self.__connection.Connect() + if(not self.__connection.Connecting()): + self.__connection.Connect() - - def __extract_status(self, Data): """ Returns a tuple (bool,bool) first: set to True if an error occur and False otherwise