homewizard / python-homewizard-energy

HomeWizard Energy API implementation in Python. Designed for Home Assistant but can be used for any Async application.
https://api-documentation.homewizard.com
Apache License 2.0
13 stars 4 forks source link

Small liters per minute values lost with HWE water meter #408

Open vsessink opened 1 week ago

vsessink commented 1 week ago

Hi devs/Duco, I've started using the HomeWizard water meter. I found that using 0.7 liters per minute (measured with a stopwatch and a jug) resulted in a steady usage of 0 liter per minute in HA, although the total amount showed a steady rise (a liter in about every 80 seconds). I have tried to verify the 0 measurement with the "official" HomeWizard app: IIRC the HomeWizard app did show usage - but the amount was zero. Yes really: "you're using water", namely: 0 liters per minute.

The reason that I tried to measure this somewhat weirdly small, and in fact artificial, water flow was that a slightly larger stream that I really did want to measure, resulted in the measurements jittering between 1.27l/m and 0 l/m in a steady on/off pattern. As the meter itself just measures rotations of the water dial, this made me think that this could be an on/off pattern of "yes, another liter used" and "no water usage" between any two measurements. But I saw what you said in bug #407 and I may have been wrong.

My HA is running on a RasPi 4 with a fairly standard setup (HAOS 13.1, HA core 2024.9.1). The watermeter says it is "HWE-WTR" with Firmware 3.01.

(As a side note, I tried to use the HA statistical derivative function to get around this, but this seems to behave a bit strange: it never returns to zero but seems to hang on to the last positive value. Edit: this is due to the fact that a non changing sensor does not fire the derivative function recalculation - workarounds for this exist, see https://github.com/home-assistant/core/issues/83496).

I'm fairly handy with operating systems and the like but only know so much about HA. Willing to help fix the issue though.

vsessink commented 1 week ago

Hi, I measured directly with the API and here are two examples. I'm using wget -nv -O - http://<IPADDRESS>/api/v1/data with 10 second delays. Water usage about 0.3 liters per minute:

zo 8 sep 2024 12:15:24 CEST: {"total_liter_m3":0.35,"active_liter_lpm":0}
zo 8 sep 2024 12:15:34 CEST: {"total_liter_m3":0.35,"active_liter_lpm":0}
zo 8 sep 2024 12:15:45 CEST: {"total_liter_m3":0.35,"active_liter_lpm":0}
zo 8 sep 2024 12:15:55 CEST: {"total_liter_m3":0.351,"active_liter_lpm":0}
zo 8 sep 2024 12:16:05 CEST: {"total_liter_m3":0.351,"active_liter_lpm":0}
zo 8 sep 2024 12:16:15 CEST: {"total_liter_m3":0.351,"active_liter_lpm":0}
[continues until]
zo 8 sep 2024 12:18:05 CEST: {"total_liter_m3":0.352,"active_liter_lpm":0}

(Times in Dutch but I'm pretty sure dat je dat wel kunt lezen [that you can read that] ;-)

Steady water usage of about 1 liter per minute:

zo 8 sep 2024 12:26:34 CEST: {"total_liter_m3":0.359,"active_liter_lpm":1.303}
zo 8 sep 2024 12:26:44 CEST: {"total_liter_m3":0.359,"active_liter_lpm":1.303}
zo 8 sep 2024 12:26:54 CEST: {"total_liter_m3":0.36,"active_liter_lpm":1.311}
zo 8 sep 2024 12:27:04 CEST: {"total_liter_m3":0.36,"active_liter_lpm":1.311}
zo 8 sep 2024 12:27:14 CEST: {"total_liter_m3":0.36,"active_liter_lpm":0}
zo 8 sep 2024 12:27:24 CEST: {"total_liter_m3":0.36,"active_liter_lpm":0}
zo 8 sep 2024 12:27:34 CEST: {"total_liter_m3":0.36,"active_liter_lpm":0}
zo 8 sep 2024 12:27:44 CEST: {"total_liter_m3":0.361,"active_liter_lpm":1.277}
zo 8 sep 2024 12:27:54 CEST: {"total_liter_m3":0.361,"active_liter_lpm":1.277}
zo 8 sep 2024 12:28:04 CEST: {"total_liter_m3":0.361,"active_liter_lpm":1.277}
zo 8 sep 2024 12:28:14 CEST: {"total_liter_m3":0.361,"active_liter_lpm":0}
zo 8 sep 2024 12:28:24 CEST: {"total_liter_m3":0.361,"active_liter_lpm":0}
zo 8 sep 2024 12:28:34 CEST: {"total_liter_m3":0.361,"active_liter_lpm":0}
zo 8 sep 2024 12:28:44 CEST: {"total_liter_m3":0.362,"active_liter_lpm":1.278}
zo 8 sep 2024 12:28:54 CEST: {"total_liter_m3":0.362,"active_liter_lpm":1.278}
zo 8 sep 2024 12:29:04 CEST: {"total_liter_m3":0.362,"active_liter_lpm":1.278}
zo 8 sep 2024 12:29:14 CEST: {"total_liter_m3":0.362,"active_liter_lpm":0}
zo 8 sep 2024 12:29:25 CEST: {"total_liter_m3":0.362,"active_liter_lpm":0}
zo 8 sep 2024 12:29:35 CEST: {"total_liter_m3":0.362,"active_liter_lpm":0}
zo 8 sep 2024 12:29:45 CEST: {"total_liter_m3":0.363,"active_liter_lpm":1.294}

This means that the water meter itself displays wrong information - i.e. it cannot calculate a proper derivative if the water usage is below some 1 or 2 liters per minute - although one definitely would want to see such usage. Ongoing water usage of 1 (or even 0.1) liter per minute could be reason for alarm ;-) IMHO.

I'm not sure if this is reason for a bug in the HWE water meter. Does your water meter show the same? Does it have the same firmware?

DCSBL commented 5 days ago

Hi @vsessink, It is the first time we got notified about a situation like this, so I want to rule out this is a hardware issue.

Can you contact the HomeWizard support helpdesk and reference back to this issue, we will arrange a replacement product so we can be sure if this is a hardware or software issue. Please send them a picture of your 'real' watermeter including the HomeWizard Watermater and the bracket.

Thank you in advance!

vsessink commented 5 days ago

I happen to have another house, another watermeter and another HWE-WTR. Checked. Seems to behave better. Will test more.

I'll test the other one too, maybe I'll exchange them, then I'll come back here. Will take about 2 weeks (sorry, other home 😕)

vsessink commented 4 days ago

OK, here are new test results. Different home, different HWE-WTR, same results. Small water usage results in l/m being zero. The following logs are both steady water usage:

vr 13 sep 2024 9:11:52 CEST: {"total_liter_m3":0.591,"active_liter_lpm":0}
vr 13 sep 2024 9:12:02 CEST: {"total_liter_m3":0.591,"active_liter_lpm":0}
vr 13 sep 2024 9:12:12 CEST: {"total_liter_m3":0.591,"active_liter_lpm":0}
vr 13 sep 2024 9:12:23 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:12:33 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:12:43 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:12:53 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:13:04 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:13:14 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:13:24 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:13:34 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:13:45 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:13:55 CEST: {"total_liter_m3":0.592,"active_liter_lpm":0}
vr 13 sep 2024 9:14:05 CEST: {"total_liter_m3":0.593,"active_liter_lpm":0}
vr 13 sep 2024 9:14:15 CEST: {"total_liter_m3":0.593,"active_liter_lpm":0}
vr 13 sep 2024 9:14:26 CEST: {"total_liter_m3":0.593,"active_liter_lpm":0}
vr 13 sep 2024 9:14:36 CEST: {"total_liter_m3":0.593,"active_liter_lpm":0}

Intermediate water usage: l/m starts jittering. Log:

vr 13 sep 2024 9:25:52 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:26:02 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:26:12 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:26:22 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:26:33 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:26:43 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:26:53 CEST: {"total_liter_m3":0.606,"active_liter_lpm":0}
vr 13 sep 2024 9:27:03 CEST: {"total_liter_m3":0.607,"active_liter_lpm":0}
vr 13 sep 2024 9:27:13 CEST: {"total_liter_m3":0.607,"active_liter_lpm":0}
vr 13 sep 2024 9:27:24 CEST: {"total_liter_m3":0.607,"active_liter_lpm":0}
vr 13 sep 2024 9:27:34 CEST: {"total_liter_m3":0.607,"active_liter_lpm":1.005}
vr 13 sep 2024 9:27:44 CEST: {"total_liter_m3":0.607,"active_liter_lpm":1.005}
vr 13 sep 2024 9:27:54 CEST: {"total_liter_m3":0.607,"active_liter_lpm":1.005}
vr 13 sep 2024 9:28:05 CEST: {"total_liter_m3":0.608,"active_liter_lpm":0}
vr 13 sep 2024 9:28:15 CEST: {"total_liter_m3":0.608,"active_liter_lpm":0}
vr 13 sep 2024 9:28:25 CEST: {"total_liter_m3":0.608,"active_liter_lpm":0}
vr 13 sep 2024 9:28:35 CEST: {"total_liter_m3":0.608,"active_liter_lpm":1.286}
vr 13 sep 2024 9:28:46 CEST: {"total_liter_m3":0.608,"active_liter_lpm":1.286}
vr 13 sep 2024 9:28:56 CEST: {"total_liter_m3":0.608,"active_liter_lpm":1.286}
vr 13 sep 2024 9:29:06 CEST: {"total_liter_m3":0.609,"active_liter_lpm":0}
vr 13 sep 2024 9:29:16 CEST: {"total_liter_m3":0.609,"active_liter_lpm":0}
vr 13 sep 2024 9:29:26 CEST: {"total_liter_m3":0.609,"active_liter_lpm":0}
vr 13 sep 2024 9:29:37 CEST: {"total_liter_m3":0.609,"active_liter_lpm":1.404}
vr 13 sep 2024 9:29:47 CEST: {"total_liter_m3":0.609,"active_liter_lpm":1.404}
vr 13 sep 2024 9:29:57 CEST: {"total_liter_m3":0.61,"active_liter_lpm":0}
vr 13 sep 2024 9:30:07 CEST: {"total_liter_m3":0.61,"active_liter_lpm":0}
vr 13 sep 2024 9:30:18 CEST: {"total_liter_m3":0.61,"active_liter_lpm":0}
vr 13 sep 2024 9:30:28 CEST: {"total_liter_m3":0.61,"active_liter_lpm":1.32}
vr 13 sep 2024 9:30:38 CEST: {"total_liter_m3":0.61,"active_liter_lpm":1.32}

Please note that I can understand that there must be some cutoff l/m value, but I'm a bit concerned by the jittering; also the l/m value cutoff seems rather low to me. Last night one of my toilets kept running - 33 liters per hour. Liters per minute: 0. An alarm when there is ongoing - but small - water usage could have helped here.

DCSBL commented 5 hours ago

Thank you for the extra information.

We were able to reproduce this issue and looking into a fix. We have added this task to the backlog, but I can't tell you when and if we going to fix this, we have not got any report other than this one about this issue, so it got a low priority.

I would suggest to see if you can fix this issue via rolling-average function in your installation, I recommend to use https://www.home-assistant.io/integrations/statistics in Home Assistant.