Monitoring water volume output from mqtt topic

My linktap water switch outputs the volume its putting out. But it resets to 0 when the valve is turned off.

I am trying to find a way to keep track of total volume per day. So the switch may turn off and on 4 times a day at random times so no way to plan to copy the volume somewhere else before.

The device is connected via Zwave2mqtt. The topic is: homeassistant/sensor/782DA523004B1200_volume

Is there some way to monitor this topic to update an input_number helper that resets each day?

This flow creates a couple of sensors. One for today’s water volume, and another one to store yesterday’s total volume, this way you can track both. Your mqtt sensor reading should be set in msg.sum. Initialize the sensor one time to 0 and you can delete that inject node.

[{"id":"fed44578.0f9e68","type":"inject","z":"878e74c2.7f39c8","name":"sum +3","props":[{"p":"sum","v":"3","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":590,"y":3740,"wires":[["222686a8.76b59a"]]},{"id":"3374dc44.575504","type":"ha-entity","z":"878e74c2.7f39c8","name":"sensor.today_total_volume","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"today_total_volume"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":1360,"y":3740,"wires":[[]]},{"id":"193b6b9d.3a67a4","type":"inject","z":"878e74c2.7f39c8","name":"Initialize sensor to 0 just the first time, otherwise it won't work","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":860,"y":3640,"wires":[["3374dc44.575504"]]},{"id":"70026ddd.2daf94","type":"inject","z":"878e74c2.7f39c8","name":"Store today's value to yesterday's value and reset to 0 every day at 00:00","props":[],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","x":280,"y":3840,"wires":[["bd2662e8.4b4f"]]},{"id":"222686a8.76b59a","type":"api-current-state","z":"878e74c2.7f39c8","name":"Get current value","server":"9405c3fe.d0a6c","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.today_total_volume","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":770,"y":3740,"wires":[["df4adcdc.a128"]]},{"id":"bd2662e8.4b4f","type":"api-current-state","z":"878e74c2.7f39c8","name":"Get current value","server":"9405c3fe.d0a6c","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.today_total_volume","state_type":"str","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":650,"y":3840,"wires":[["64a4913d.6238a"]]},{"id":"64a4913d.6238a","type":"ha-entity","z":"878e74c2.7f39c8","name":"sensor.yesterday_total_volume","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"yesterday_total_volume"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":890,"y":3840,"wires":[["c9878f25.c7819"]]},{"id":"ac49d137.269fd","type":"comment","z":"878e74c2.7f39c8","name":"Your mqtt sensor readings through here --- >>","info":"","x":330,"y":3740,"wires":[]},{"id":"c9878f25.c7819","type":"change","z":"878e74c2.7f39c8","name":"Reset today's sensor","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":3840,"wires":[["3374dc44.575504"]]},{"id":"df4adcdc.a128","type":"change","z":"878e74c2.7f39c8","name":"payload to payload + sum","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload + sum","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":3740,"wires":[["3374dc44.575504"]]},{"id":"e3ba48f0.d73a58","type":"comment","z":"878e74c2.7f39c8","name":"Today's total volume","info":"","x":1330,"y":3700,"wires":[]},{"id":"125a9e57.dce382","type":"comment","z":"878e74c2.7f39c8","name":"Yesterday's total volume","info":"","x":870,"y":3800,"wires":[]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]