Skip to content

Commit

Permalink
Update plugin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Smanar authored Apr 7, 2019
1 parent 798621a commit 025faaf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def __init__(self):
return

def onStart(self):

Domoticz.Debug("onStart called")
#CreateDevice('1111','sensors','ZHAConsumption')

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 025faaf

Please sign in to comment.