Finding a cost effective Tuya water timer that can be converted, has been a bit of a hit and miss.
Earlier this year I found this Water Timer. Price was about $60 AUD from AliExpress. The Timer itself uses the TYWE1S module and consists of a single button and relay to control the valve.
Manufacture: Benexmart
Model: FJSJKZQ-TY-W-XV-JS (PCB Markings)
I have been running the timer via the regular Tuya integration with Home Assistant, but had the odd event when it failed to turn off.
The original vendor listing isn't active, but I found these links.
TuyaSmart Life Store
https://www.aliexpress.com/item/4001244982369.html
https://www.aliexpress.com/item/4001363870790.html
Opening
Tasmota config
Device has LED (red), Button and relay. The Green led is linked to the valve state and not controllable independantly.
{"NAME":"FJSJKZQ","GPIO":[0,0,0,0,32,0,0,0,288,0,224,0,0,0],"FLAG":0,"BASE":18}
Set red led to reflect WiFi/MQTT connection state (optional)
LedPower 1
Automatic turn off after 15 minutes (900 Seconds)
Rule1 ON power1#state=1 DO RuleTimer1 900 ENDON ON Rules#Timer=1 DO Power1 off ENDON
ESPHome Config (Update Feb 24)
esphome:
name: watervalve
friendly_name: WaterValve
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "<snip>"
ota:
password: "<snip>"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: .ha
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Watervalve Fallback Hotspot"
password: "<snip>"
captive_portal:
web_server:
port: 80
auth:
username: !secret web_server_admin_user
password: !secret web_server_password
script:
- id: valve_failsafe
mode: restart # Solenoid will be kept on for another 60 minutes since
# the latest time the script is executed
then:
- logger.log: "FAILSAFE set for 60 minutes"
#- delay: 1 min
- delay: 60 min
- logger.log: "FAILSAFE TRIGGERED!!! Turning off valve"
- switch.turn_off: water_valve
time:
- platform: homeassistant
id: homeassistant_time
on_time_sync:
then:
- logger.log: "Synchronized system clock"
switch:
- platform: gpio
pin: GPIO14
name: water_valve
id: water_valve
#restore_mode: always off # default when power is turned on
icon: mdi:pipe-valve
# synchronise the LED with the relay
on_turn_on:
then:
- logger.log: "Water Valve On"
- output.turn_on: valve_led
- script.execute: valve_failsafe # Set timer for 60 minutes
on_turn_off:
then:
- logger.log: "Water Valve Off"
- output.turn_off: valve_led
- script.stop: valve_failsafe # Cancel Set timer for 60 minutes
- platform: restart
id: restart_controller
binary_sensor:
- platform: gpio
pin: GPIO4
name: Button
id: button
device_class: window
# when button is pressed, toggle the switch on/off
on_press:
then:
- switch.toggle: water_valve
- platform: status
name: Controller status
- platform: homeassistant
name: "Irrigation - Rear garden"
entity_id: calendar.irrigation_water_valve
on_press:
then:
- switch.turn_on: water_valve
on_release:
then:
- switch.turn_off: water_valve
output:
- platform: gpio
id: valve_led
pin: GPIO12
#restore_mode: always off # default when power is turned on
sensor:
- platform: wifi_signal
name: Garden Controller WiFi Signal
update_interval: 10s
- platform: uptime
name: Garden Controller Uptime