Ensuring Zigbee Valve Reliability with Vibration Sensors in Home Assistant

Ensuring Zigbee Valve Reliability with Vibration Sensors in Home Assistant

When it comes to smart home automation, reliability is key. One issue that many users face is with Zigbee valves, such as the TS0049 by _TZ3210_0jxeoadc which I personally have. Even though these valves appear to turn on from Home Assistant (the switch is on), the actual physical valve may not always open. This can be a significant problem, especially in irrigation systems where the failure to turn on a valve can lead to dry patches in your garden.

The Problem

The main issue with Zigbee valves is that the signal sent to turn them on does not always result in the physical valve opening. This discrepancy can be due to a variety of factors, including poor signal strength, interference, or issues with the valve itself. To ensure that the valve has indeed opened, we need a reliable method of verification.

The Solution

One effective way to verify the operation of the valve is by using a vibration sensor. When the valve starts working, it produces a slight vibration. By placing a vibration sensor on top of the valve, we can detect this vibration and confirm that the valve is truly open.

Home Assistant Automation

To implement this solution, we can create an automation in Home Assistant that uses the vibration sensor to confirm the valve’s operation. Below is the code for the automation:

repeat:
  sequence:
    - service: switch.turn_off
      metadata: {}
      data: {}
      target:
        entity_id: switch.back_irrigation_switch
      enabled: true
    - delay:
        hours: 0
        minutes: 0
        seconds: 30
        milliseconds: 0
      enabled: true
    - service: switch.turn_on
      metadata: {}
      data: {}
      target:
        entity_id: switch.back_irrigation_switch
      enabled: true
    - delay:
        hours: 0
        minutes: 0
        seconds: 4
        milliseconds: 0
      enabled: true
    - service: input_number.set_value
      metadata: {}
      data:
        value: "{{repeat.index}}"
      target:
        entity_id: input_number.back_irrigation_attempts
  until:
    - condition: template
      value_template: >-
        {{states('binary_sensor.back_irrigation_vibration_sensor') ==
        'on' or repeat.index == 5}}
enabled: true
continue_on_error: true

This automation works by first turning off the valve switch, waiting for 30 seconds, and then turning it back on. After a short delay of 4 seconds, it checks if the vibration sensor has detected any vibration. If not, it repeats the process up to 5 times. Additionally, we use an input_number helper to track how many times this loop fails, allowing us to receive a notification if the issue persists.

Tracking Attempts

By using the input_number helper, we can track the number of attempts made to open the valve. This helps in identifying persistent issues and ensures that we are notified if the valve fails to open after several attempts.

What To Buy

Conclusion

Ensuring the reliability of your Zigbee valves is crucial for the smooth operation of your smart home. By using vibration sensors in conjunction with Home Assistant automations, you can verify that your valves are indeed opening as expected. This approach helps mitigate the common issue of signal failure and ensures that your irrigation system operates reliably.

Do you have any other smart home automation tips or experiences? Share them in the comments below!


1 Comment

Leave a Reply