Advertisement
poldim

Untitled

Jul 7th, 2020
1,497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.61 KB | None | 0 0
  1. script:
  2.   - id: update_state
  3.     then:
  4.       - if:
  5.           condition:
  6.             and:
  7.              - switch.is_on: valve_is_open
  8.              - switch.is_on: valve_is_closed
  9.           then:
  10.             - text_sensor.template.publish:
  11.                 id: valve_position
  12.                 state: "ERROR: BOTH VALVE STATES HIGH"
  13.             - switch.turn_on: close_the_valve
  14.       - if:
  15.           condition:
  16.             and:
  17.              - switch.is_off: valve_is_open
  18.              - switch.is_off: valve_is_closed
  19.           then:
  20.             - text_sensor.template.publish:
  21.                 id: valve_position
  22.                 state: "Moving"
  23.             - script.stop: error_check
  24.       - if:
  25.           condition:
  26.             and:
  27.              - switch.is_on: valve_is_open
  28.              - switch.is_off: valve_is_closed
  29.           then:
  30.             - text_sensor.template.publish:
  31.                 id: valve_position
  32.                 state: "Open"
  33.       - if:
  34.           condition:
  35.             and:
  36.              - switch.is_off: valve_is_open
  37.              - switch.is_on: valve_is_closed
  38.           then:
  39.             - text_sensor.template.publish:
  40.                 id: valve_position
  41.                 state: "Closed"
  42.   - id: error
  43.     then:
  44.       - delay: 10s
  45.       - if:
  46.           condition:
  47.             and:
  48.              - switch.is_off: valve_is_open
  49.              - switch.is_off: valve_is_closed
  50.           then:
  51.             - text_sensor.template.publish:
  52.                 id: valve_position
  53.                 state: "ERROR: BOTH VALVE STATES LOW FOR 10S"
  54.             - switch.turn_on: close_the_valve
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement