Page 1 of 1

Python create water sensor

Posted: Thursday 11 October 2018 11:09
by jeroenb42
I have been working on updating the Homewizard plugin created by @Wobbles (I have an energylink which his code does not yet cover) and I am trying to add a water sensor. I have seen images of people who have a water meter in Domoticz with an indication of liter. I've managed to create a counter that has an m3 measure but I want to have is liters. How can I do that? And more importantly, how can I do that in Python.

What I have is this:
Domoticz.Device(Name="Water Day", Unit=self.water_today_id, TypeName="Counter Incremental", Image=11, Switchtype=2).Create()

It creates what I want except for the liter indication. Any way I can either change that after I create it or create it correctly right away?

@Wobbles, once I have a stable update, I will share it with you. Can you send me a PM with your email address so we can chat?

Re: Python create water sensor

Posted: Saturday 13 October 2018 13:20
by jeroenb42
I got my own question answered so I thought I would share the results.

The homewizard has 2 water values (at least in my case), waterflow and water usage. I created the sensors using the following code:

Waterflow
Domoticz.Device(Name="Water", Unit=self.water_id, TypeName="Waterflow").Create()

Water usage in liters
MyOptions = {"ValueQuantity":"Volume","ValueUnits":"liters"}
Domoticz.Device(Name="Water Day", Unit=self.water_today_id, Type=113, Switchtype=3, Options=MyOptions).Create()