For a plugin, i need to update the BatteryLevel to devices in domoticz
To do it, i have update the UpdateDevice code like that :
before :
Code: Select all
def UpdateDevice(Unit, nValue, sValue):
# Make sure that the Domoticz device still exists (they can be deleted) before updating it
if (Unit in Devices):
if (Devices[Unit].nValue != nValue) or (Devices[Unit].sValue != sValue):
Devices[Unit].Update(nValue, str(sValue))
Domoticz.Log("Update "+str(nValue)+":'"+str(sValue)+"' ("+Devices[Unit].Name+")")
return
Code: Select all
def UpdateDeviceWithBattery(Unit, nValue, sValue, CustomImage, SignalLevel, BatteryLevel):
# Make sure that the Domoticz device still exists (they can be deleted) before updating it
if (Unit in Devices):
if (Devices[Unit].nValue != nValue) or (Devices[Unit].sValue != sValue) or (Devices[Unit].SignalLevel != SignalLevel) or (Devices[Unit].BatteryLevel != BatteryLevel) :
Devices[Unit].Update(nValue, str(sValue),CustomImage, SignalLevel, BatteryLevel)
Domoticz.Log("Update "+str(nValue)+":'"+str(sValue)+"' SignalLevel:"+str(SignalLevel)+" batteryLevel:'"+str(BatteryLevel)+"%' ("+Devices[Unit].Name+")")
return

If anyone know how to get it ...
thk's