Advertisement
yurghie

select to relay

Jun 14th, 2023
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.10 KB | None | 0 0
  1.  
  2. input_select:
  3.   ventilation_state:
  4.     name: Ventilation state
  5.     options:
  6.      - First state
  7.       - Second state
  8.       - Third state
  9.       - Fourth state
  10.     icon: mdi:fan
  11.  
  12. automation:
  13.   alias: ventilation_set_state
  14.   trigger:
  15.     - platform: state
  16.       entity_id: input_select.ventilation_state
  17.   action:
  18.     - choose:
  19.       - conditions: '{{trigger.to_state.state == "Third state"}}'
  20.         sequence:
  21.           - service: light.turn_on
  22.             entity_id: light.first_relay, light.second_relay
  23.       - conditions: '{{trigger.to_state.state == "Second state"}}'
  24.         sequence:
  25.           - service: light.turn_on
  26.             entity_id: light.second_relay
  27.           - service: light.turn_off
  28.             entity_id: light.first_relay
  29.       - conditions: '{{trigger.to_state.state == "Fourth state"}}'
  30.         sequence:
  31.           - service: light.turn_on
  32.             entity_id: light.first_relay
  33.           - service: light.turn_off
  34.             entity_id: light.second_relay
  35.       default:
  36.         service: light.turn_off
  37.         entity_id: light.first_relay, light.second_relay
  38.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement