Hi, i have recently bought a SONOFF Smart Water Valve and i have connected it throught Zigbee2MQTT to my server. Some entities are discovered like the switch that turns it on and off and the flow rate senor which outputs data in m^3/h. I would like to create an entity which tracks the total water consumed since the last on state of the valve and an automation to turn it off after an X amount of liters have been through. I tried using an utility meter helper, however the results where in m^3/h and not m^3 or liters. Any ideas?
Hey just stumbled upon your post. I have two of these SONOFF WMV zigbee water valves and Iām having no luck with either of them for the volume flow rate entity. See my lengthy post and testing here:
Have you had any luck or issues with the volume flow rate entity on these?
Did you manage to get this resolved? Iām also trying to track usage but no luck so far.
No luck here either, so probably not a hardware issue.
@Akubra and @michaelcox12 I got my two Sonoff smv valves working properly now with flow rate. What fix it for me was changing it from zha Network to z2m network. This was also the recommendation from sonoff support.
Good stuff @Gurulee . I am using z2m as well. Are you able to share how you set up your sensors (I assume you have 2+ to get a working result) ?
@Gurulee Thanks but correct me if Iām wrong, this is only showing the flow rate and does not show the actual usage?
Flow rate equates to actual usage. If thereās no flow detected then thereās no usage.
I also created this custom template sensor to track total gallons over time:
sensor:
- platform: template
sensors:
total_water_usage:
friendly_name: "Total Water usage"
unit_of_measurement: "gal"
value_template: "{{ states('sensor.water_valve_flow') | float * states('sensor.valve_open_time') | float }}"
Where did you get āsensor.valve_open_timeā from as there is no such property on the Sonoff valve I have.
The solution for your problem is quite easy, use the integral sensor under helpers. Just configure it to your needs, i have my sonoff configured to l/min and the integral sensor is calculating the total liters. Just put your valve volume entity, your time unit, the calculation method (i use trapezoidal), interval to 1s and thats it. Dont put any metric prefix. The only drawback, you cant use historical data.
I tested it at 1,67 l/min, opened the valve manually for a minute and got 1,59l. I guess thats quit accurate, considering manuall testing.
It was created as a custom template sensor.
I changed it to user custom input number helpers instead with an automation:
input_number.yaml
garden_hose_usage_total:
name: Garden Hose Usage Total
initial: 0
min: 0
max: 100000 # Adjust based on size
step: 1
unit_of_measurement: "gal"
mode: box # Prevents slider control
Automation:
alias: "Garden hose usage total update "
description: ""
triggers:
- minutes: /1
trigger: time_pattern
enabled: true
conditions:
- condition: state
entity_id: switch.side_hose_spigot_valve
state: "on"
enabled: true
actions:
- data:
value: "{{ states('input_number.garden_hose_usage_total') | float + 1 }}"
action: input_number.set_value
enabled: true
target:
entity_id: input_number.garden_hose_usage_total
mode: single