Page 1 of 1
Python Plugin / Managed Counter device
Posted: Tuesday 22 June 2021 9:46
by breizhcat
Hello!
I'm trying to implement my own plugin. To achieve my needs, I would like to have a managed counter.
It works fine but I'm currently not able to add a divider when I create my device.
Code: Select all
Domoticz.Device(Name= 'Device Name', Unit=DEVICE_ODOMETER, Type=243, Subtype=33, Switchtype=3,
Options={'AddjValue2': 1000, 'ValueQuantity': 'Kilometers', 'ValueUnits': 'Km', 'AddDBLogEntry' : 'true', 'DisableLogAutoUpdate' : 'true'},
Image=Images[IMAGE_DEVICE_ODO].ID, Description='Distance driven', Used=1).Create()
My device is well created. Quantity and units are loaded, history is loaded but ... the divider (AddjValue2 it seems) is not loaded.
Is there a way to create a device with the correct divider value?
Thanks for your help.
Have a good day.
Re: Python Plugin / Managed Counter device
Posted: Tuesday 22 June 2021 10:40
by pipiche
removing the comment as it doesn't address the question
Re: Python Plugin / Managed Counter device
Posted: Tuesday 22 June 2021 11:30
by azonneveld
Not an answer to your question, but please change "Distance drived" to "Distance driven"
Re: Python Plugin / Managed Counter device
Posted: Tuesday 22 June 2021 13:59
by breizhcat
azonneveld wrote: ↑Tuesday 22 June 2021 11:30
Not an answer to your question, but please change "Distance drived" to "Distance driven"
Yes ! Thanks

Re: Python Plugin / Managed Counter device
Posted: Saturday 31 December 2022 20:15
by RedEarth
breizhcat wrote: ↑Tuesday 22 June 2021 9:46
Hello!
I'm trying to implement my own plugin. To achieve my needs, I would like to have a managed counter.
It works fine but I'm currently not able to add a divider when I create my device.
Code: Select all
Domoticz.Device(Name= 'Device Name', Unit=DEVICE_ODOMETER, Type=243, Subtype=33, Switchtype=3,
Options={'AddjValue2': 1000, 'ValueQuantity': 'Kilometers', 'ValueUnits': 'Km', 'AddDBLogEntry' : 'true', 'DisableLogAutoUpdate' : 'true'},
Image=Images[IMAGE_DEVICE_ODO].ID, Description='Distance driven', Used=1).Create()
My device is well created. Quantity and units are loaded, history is loaded but ... the divider (AddjValue2 it seems) is not loaded.
Is there a way to create a device with the correct divider value?
Thanks for your help.
Have a good day.
Did you ever find a solution to this? I've encountered the same problem with a plugin that I'm trying to create that requires managed counter devices with Counter Divider set to 1000 but it's ignoring AddjValue2 for me too...
Code: Select all
Domoticz.Device(Name="elecUnitCost", Unit=self.elecUnitCost, Type=243, Subtype=33, Switchtype=3, Options={'AddjValue2': 1000, 'ValueQuantity': 'cost', 'ValueUnits': 'p/kWh'}, Used=1).Create()
I'm not sure whether or not this syntax is correct for specifying the device options?
Re: Python Plugin / Managed Counter device
Posted: Sunday 01 January 2023 14:00
by waltervl
Are you sure you want to use a managed counter in your plugin? As it has no build in history function so you also have to program it yourself....
Re: Python Plugin / Managed Counter device
Posted: Sunday 01 January 2023 15:18
by RedEarth
waltervl wrote: ↑Sunday 01 January 2023 14:00
Are you sure you want to use a managed counter in your plugin? As it has no build in history function so you also have to program it yourself....
Yes the API I'm using effectively presents the smart meter data as 'history' (i.e. a list of values with accompanying timestamps), the newest available data is always at least 24 hours old, so managed counter seems to be the best fit.