In this video I present the problem I encountered with the Useelink Tuya based water shut-off valve and the solution I found to solve it. We have frequent power cuts in my area, most of them last 10-30 seconds, but are enough to disturb some of my domotics. While my Internet router is protected with a UPS, some of my other devices are not. In the case of the water valve, the problem I encountered was that after a power cut, it defaults to the shut position, leaving my water mains turned off. The Smart Life app does not provide any settings in order to change this behavior so I had to look for a solution of my own. I am sure there might be better solutions out there but this was completely free, I did not have to invest any money in buying more hardware, and it works very well so far. All other solutions I found on various forums were not suitable for me as they were either too complicated or involved spending money on extra hardware.
Here is the code for the ping binary sensor:
# Ping sensor
- platform: ping
name: "ping my camera"
host: 192.168.1.xx
count: 3
scan_interval: 30
Having made this, I created the following automations:
The first one sends me a Telegram notification 45 seconds after it turns from ON to OFF because it can no longer ping my camera.
alias: Water Valve offline notification
description: ''
trigger:
- entity_id: binary_sensor.ping_my_camera
for: 00:00:45
platform: state
to: 'off'
condition: []
action:
- data:
message: Ping Sensor Offline. Power Outage!
service: notify.telegram
The second automation waits 30 seconds after the ping sensor changes back to ON, then turns on the valve and notifies me on Telegram. So the entire process takes about 1 minute and 30 seconds for the water mains to be turned back on in case of a short power cut of 10-15 seconds.
alias: Turn on water valve after power restored
description: ''
trigger:
- entity_id: binary_sensor.ping_garage_camera
for: 00:00:30
from: 'off'
platform: state
to: 'on'
condition: []
action:
- entity_id: switch.water_shutoff_valve
service: switch.turn_on
- data:
message: Water Valve Back ON!
service: notify.telegram
This works quite well for me, I have not yet had any issues with it, so I decided to publish it and hopefully help someone out looking for a similar solution. If you happen to think of an improved or much better solution, I will be happy to learn about it, please leave a comment below.
Thank you for watching and sorry for my occasional stuttering. I hope I was able to give you some Home Assistant automation ideas.
Since some people have been asking for the products I used, here are the links:
Xiaomi Gateway:
[ Ссылка ]
Xiaomi Aqara Water leak sensor:
[ Ссылка ]
Tuya Water Shut-off Valve:
[ Ссылка ]
Ещё видео!