Current code to create/update that counter is:
Code: Select all
def UpdateCounter(vn,idx,name,value):
if (not vn in Devices) or (not idx in Devices[vn].Units):
Domoticz.Unit(Name=Parameters["Name"]+"-"+name, Unit=idx, Type=113, Switchtype=3, DeviceID=vin, Options="{'ValueQuantity': 'Distance','ValueUnits': 'km'}",Used=True).Create()
Devices[vin].Units[idx].nValue = value
Devices[vin].Units[idx].sValue = value
Devices[vin].Units[idx].Update(Log=True)
Domoticz.Log("Counter ("+Devices[vin].Units[idx].Name+")")
So what is the correct code for creating a counter with "km" as unit?