From 025faaf9f8eb5655a74f33013a438f023e8e8b77 Mon Sep 17 00:00:00 2001 From: Smanar Date: Sun, 7 Apr 2019 13:31:05 +0200 Subject: [PATCH] Update plugin.py --- plugin.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugin.py b/plugin.py index 45be184..3af1ea3 100644 --- a/plugin.py +++ b/plugin.py @@ -77,7 +77,6 @@ def __init__(self): return def onStart(self): - Domoticz.Debug("onStart called") #CreateDevice('1111','sensors','ZHAConsumption') @@ -415,6 +414,8 @@ def onHeartbeat(self): _id = self.Devices[i]['id'] UpdateDevice(_id,'sensors', { 'nValue' : 0 , 'sValue' : 'Off' } ) self.NeedToReset = [] + + #Devices[27].Update(nValue=0, sValue='11;22' ) def onDeviceRemoved(self,unit): Domoticz.Log("Device Removed") @@ -683,6 +684,14 @@ def WebSocketConnexion(self,_Data): else: Domoticz.Status("###### Device just re-connected : " + str(_Data) + "But ignored") + if ('tampered' in state) or ('lowbattery' in state): + tampered = state.get('tampered',False) + lowbattery = state.get('lowbattery',False) + if tampered or lowbattery: + kwarg.update({'TimedOut':1}) + Domoticz.Error("###### Device with hardware defaut : " + str(_Data)) + + #MAJ config elif 'config' in _Data: config = _Data['config'] @@ -1029,7 +1038,7 @@ def CreateDevice(IEEE,_Name,_Type): kwarg['Type'] = 244 kwarg['Subtype'] = 62 kwarg['Switchtype'] = 5 - #kwarg['Image'] = 11 # Not working for this kind of device + kwarg['Image'] = 11 # Visible only on floorplan elif _Type == 'ZHAFire' or _Type == 'ZHACarbonMonoxide': kwarg['Type'] = 244