Sunday, 26 December 2021

Benexmart Irrigation Timer - Tasmota / ESPHome conversion

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





As with recent devices, this was shipped with the newer Tuya firmware that doesn't work with tuya-convert, and needs to be flashed directly via serial.


credit


Important note: Make sure your flasher is set to 3.3v

Opening

Opening the device takes a little patience. Case is glued. I started at the bottom (vents) and pried around, carefully breaking the glue. Once open you can access the 4 screws holding the front plate on. These have a small amount of silicon applied, but easily removed.


Tasmota config

There wasn't an existing Template for this device, but it was simple enough to create.

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}


GPIO4 - Button - 1
GPIO12 - Led - 1
GPIO14 Relay - 1

Other Config

Console commands to configure auto off rule, in case of WiFi/MQTT interruption and (red) LED function.

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
Rule1 1

ESPHome Config (Update Feb 24)

This is a sample ESPHome config. It features fail safe to turn off after 60 mins where wifi connection is lost. It leverages a Home Assistant calendar for flexible scheduling. 

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




5 comments:

  1. Hi, i try to open the device, can you please give some details for opening the device? wich part of the case is to open, the grey or the blue?

    ReplyDelete
    Replies
    1. If that's not clear, split rear grey housing and the aqua with a pry tool / spatula. Then that will expose the screw holding on the front panel (grey plastic fascia)

      Delete
  2. The front section is fastened from the inside. You need to spearate the rear shell from the front section. The can then access the screws to release the front panel.

    ReplyDelete