Add HomeWizard WiFi watermeter in Domoticz

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Broomer23
Posts: 6
Joined: Monday 08 October 2018 11:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Add HomeWizard WiFi watermeter in Domoticz

Post by Broomer23 »

Not sure this is the right place but I want to share my successfull addition of HomeWizard Watermeter in Domoticz.

First start by looking up the IP address the Watermeter is using.
Then add hardware type HTTP/HTTPS poller in domoticz using the url with IP address including the API:
http://your-ip/api/v1/data
The name for the hardware can be WaterMeter, but is arbitrary
Be sure to select GET as Methode
Use water.lua as command.

Now create two virtual sensors
Water - WaterFlow
WaterTotaal - Custom - axis label: m3
Note the IDX value of both virtual sensors

water.lua
Next you must create the script called water.lua (name is arbitrary, but use the same name everywhere)
Connect to your domoticz via Putty and and go to the directory where domoticz is installed.
Go to the subfolder .../domoticz/scripts/lua_parsers
create the file water.lua with sudo privileges.
Insert the following:

-- Read API values
s = request['content'];

--
-- Watermeter
--
local idWater = use the idx for the water sensor
local a = domoticz_applyJsonPath(s,'.active_liter_lpm')
domoticz_updateDevice(idWater,'',a*1000)

local idWaterTotaal = use the idx for the WaterTotaal sensor
local b = domoticz_applyJsonPath(s,'.total_liter_m3')
domoticz_updateDevice(idWaterTotaal,'',b*1000)


Save the file, goto Domoticz and watch until values appear in the sensors.

Success!
AdAd
Posts: 2
Joined: Tuesday 16 July 2013 19:08
Target OS: -
Domoticz version:
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by AdAd »

Thanks for this.

i have only 2 questions.
1. Why multiplying active_liter_lpm by 1000? It's already in liters so no need to multiply
2. Why multiplying total_liter_m3 by 1000? if i compare it with the app the value that is pushed to domoticz is in m3 so it doesn't need to be multiplied. ("waterToaal" has the label m3 as you stated)
Broomer23
Posts: 6
Joined: Monday 08 October 2018 11:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by Broomer23 »

You are right. I also realized this later. I will change it. Thanks
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by FireWizard »

Hello @AdAd and @Broomer23,

I wonder, if the conclusion, you made, is correct.

The API of the HomeWizard water meter provides the following data:

Code: Select all

{"wifi_ssid":"Name",
"wifi_strength":100,
"total_liter_m3":0.494,
"active_liter_lpm":0}
@AdAd wrote:
i have only 2 questions.
1. Why multiplying active_liter_lpm by 1000? It's already in liters so no need to multiply
I think this is correct, at least if you use a virtual sensor of the type General, Waterflow (See below)
The water flow is presented in l/min and in the JSON response you can see that it is a value of "active_liter_lpm".
So there is no need for a multiplication factor.

@AdAd also wrote:
2. Why multiplying total_liter_m3 by 1000? if i compare it with the app the value that is pushed to domoticz is in m3 so it doesn't need to be multiplied. ("waterToaal" has the label m3 as you stated)
This looks correct, but is not.

If you push the value of total_liter_m3 to Domoticz, which is in my case 0.494 m3 (= 494 liter), your total usage is correctly updated with the value added to the Offset. But the daily value (in the upper right corner) stays at 0 (zero).
In order to get a correct indication on your device, you have to multiply the value of total_liter_m3 *1000, so that you do not send m3, but liter.
In order to correct this, go to Setup > Settings > Meters/Counters and under "RFXMeter/Counter Dividers:" under "Water" insert 1000 as divider.

Screenshot_RFX_meter_dividers.png
Screenshot_RFX_meter_dividers.png (41.83 KiB) Viewed 5823 times

It looks strange to multiply it first and then correct it again by dividing the value. But if you don't do that, it will show in the upper right corner always 0 Liter.

If everything is correct, it has to look as follows:

Screenshot_HomeWizard_watermeter.png
Screenshot_HomeWizard_watermeter.png (105.35 KiB) Viewed 5823 times

In my case the Offset has been 1472.405 m3.

Now you get your daily, monthly, etc, logging.

Regards
Last edited by FireWizard on Thursday 20 October 2022 22:14, edited 1 time in total.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by gizmocuz »

Interesting device... I made myself a meter with a Proximity sensor (NPN) and a ESP8266, total costs about 10-15 euro. It outputs MQTT
Had to print a holder for the meter, so this seems like a nice and easy system that everyone can use

I understand you can connect a USB cable to this device. Does this mean you can power it from the USB? (No need for bateries)
Can you connect the USB to your computer and receive data as well

Do you have to enable API mode in the meter via the App like described below?

Code: Select all

Enabling the API
To access the data from an Energy device, you have to enable the API. You can do this in the HomeWizard Energy app (version 1.5.0 or higher). Go to Settings > Meters > Your meter, and turn on Local API.
Quality outlives Quantity!
edwin1234
Posts: 249
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by edwin1234 »

Very nice,

I also have one, but have problems with the wifi,
Its in the meterput and there is isolation in it and around it with silver foil. I need to somehow extend the wifi antenna.
But dont no how.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by FireWizard »

Hello @gizmocuz.

I had already the idea, to create something myself as well The costs of this device is higher than yours 10-15 Euro, but it fits nice and you can install it in a few minutes. Other nice thing is you can remove it easily, if an employee of the water company want to read the meter. It is pity that there is no MQTT, so you have to poll the device.

For a complete review (in Dutch), see: https://www.iculture.nl/reviews/homewiz ... er-review/
I understand you can connect a USB cable to this device. Does this mean you can power it from the USB? (No need for bateries)
Yes, in the delivery, you will find a USB power supply (like for a smartphone), together with a fairly long USB cable (about 2m)
Can you connect the USB to your computer and receive data as well
Not that I'm aware of. I think it it is only for the power supply. At least I use it with the power supply, that has been delivered with the device.

If you do not use the USB power supply, you do not have (almost) real-time monitoring and also the API is not available.
With batteries it updates the app a couple of times/day. And indeed you have to enable the API. Disabled by default.

I believe most users will not use the API, except guys like you and me. The API is very simple. see: https://homewizard-energy-api.readthedo ... oints.html

@edwin1234.

I do not have that problem as I have an access point at about 2 m in the meter cabinet.
Wifi_strength is always at 100.

Regards
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by gizmocuz »

For reference, hereby my sketch/document

https://github.com/gizmocuz/esp_proximity_sensor_mqtt
Quality outlives Quantity!
AdAd
Posts: 2
Joined: Tuesday 16 July 2013 19:08
Target OS: -
Domoticz version:
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by AdAd »

FireWizard wrote: Monday 17 October 2022 21:33 Hello @AdAd and @Broomer23,

I wonder, if the conclusion, you made, is correct.


Now you get your daily, monthly, etc, logging.

Regards
You are totally right. The total value does indeed need a multiply by 1000. When i changed it i got the bars in the graph for the daily hourly usage. Thank you verry much.
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by Hesmink »

FireWizard wrote: Monday 17 October 2022 21:33
In my case the Offset has been 1472.405 m3.
How did you get the offset in there?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by waltervl »

Hesmink wrote: Wednesday 28 December 2022 21:00
FireWizard wrote: Monday 17 October 2022 21:33
In my case the Offset has been 1472.405 m3.
How did you get the offset in there?
Should be an option in device widget button Edit
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by FireWizard »

Hello @Hesmink

Go to your Watermeter widget and click "Edit".

Screenshot_WaterUsage_Widget.png
Screenshot_WaterUsage_Widget.png (47.92 KiB) Viewed 5251 times

The "Configuration" screen will open and insert the desired value.

Screenshot_WaterUsage_Widget_Config.png
Screenshot_WaterUsage_Widget_Config.png (35.73 KiB) Viewed 5251 times

Insert the desired "Meter Offset" and click "Update".

Regards
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by Hesmink »

FireWizard wrote: Friday 30 December 2022 15:06 Hello @Hesmink

Go to your Watermeter widget and click "Edit".


Screenshot_WaterUsage_Widget.png


The "Configuration" screen will open and insert the desired value.


Screenshot_WaterUsage_Widget_Config.png


Insert the desired "Meter Offset" and click "Update".

Regards
Got it. As per OP, I used the custom sensor, and you cannot add the offset there. I now updated it to a counter of type water. Issue solved, thanks.
SanderRoelofs
Posts: 17
Joined: Thursday 11 March 2021 10:03
Target OS: Windows
Domoticz version:
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by SanderRoelofs »

If someone is interested you can combine the p1 meter and water meter together in one script see: viewtopic.php?p=297035#p297035

Also voltage reading through telegram is possible.
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by mvveelen »

I've added the watermeter as described in the OP and it works. I think. When I open the watertap, I see the flow but it's like:
Scherm­afbeelding 2023-04-21 om 12.06.27.png
Scherm­afbeelding 2023-04-21 om 12.06.27.png (101.04 KiB) Viewed 4475 times
Seems not correct, how can I change this?
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
azonneveld
Posts: 153
Joined: Wednesday 02 October 2019 7:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by azonneveld »

mvveelen wrote: Friday 21 April 2023 12:07 Seems not correct, how can I change this?
OLD

Code: Select all

local a = domoticz_applyJsonPath(s,'.active_liter_lpm')
domoticz_updateDevice(idWater,'',a*1000)
NEW

Code: Select all

local a = domoticz_applyJsonPath(s,'.active_liter_lpm')
domoticz_updateDevice(idWater,'',a*1)
rpi4 - zigbee2mqtt - roborock - espeasy - rfxcom - homewizard p1 - otgw - homebridge - surveillance station - egardia - goodwe - open weather map - wol - BBQ detection - rsync backup
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by mvveelen »

Ah, OK. That should do the trick.

I now face another issue. I followed the instructions in the OP and also followed the instructions to NOT use a custom sensor but a counter, but the first is useless because I can't adjust the offset and the second remains zero.

I'd like to change the offset so the current amount reflects what is on the meter itself. Any ideas?
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by FireWizard »

Hello @mvveelen,

You wrote:
I've added the watermeter as described in the OP and it works. I think. When I open the watertap, I see the flow but it's like:
What do you mean with OP? Original Poster?

It looks like you mixed the "total_liter_m3" with "active_liter_lpm".

How do you send the data to Domoticz?
Can you share the script or in case, you use Node-Red, the contents of the Function node?

Regards
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by mvveelen »

OP = Opening post

LUA script I've uploaded:

Code: Select all

-- Read API values
s = request['content'];

--
-- Watermeter
--
local idWater = 2099
local a = domoticz_applyJsonPath(s,'.active_liter_lpm')
domoticz_updateDevice(idWater,'',a*1)

local idWaterTotaal = 2100
local b = domoticz_applyJsonPath(s,'.total_liter_m3')
domoticz_updateDevice(idWaterTotaal,'',b*1000)

local idWaterVerbruik = 2101
local c = domoticz_applyJsonPath(s,'.total_liter_m3')
domoticz_updateDevice(idWaterVerbruik,'',c*1000)

2101 Watermeter Waterverbruik RFXMeter RFXMeter counter 234.263 m3
2100 Watermeter WaterTotaal General Custom Sensor 66 L
2099 Watermeter Stroomsnelheid water General Waterflow 0 l/min

Where did I go wrong you think?
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Add HomeWizard WiFi watermeter in Domoticz

Post by FireWizard »

Hello @mvveelen,

I have never worked with lua, but as far as I do understand this, it is allright.

Just a Question.

What is your setting in Setup >> Settings >> Meters/Counters for Water. This should be 1000.
And what is your setting in the "Water" widget if you press "Edit". See Counter Divider.
This should be 0 (zero). If this contains also 1000, then I understand your 1,000.000.

Regards
Last edited by FireWizard on Monday 14 August 2023 16:46, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest