bikoo
(Bikoo)
1
Hello team,
thank you so much for all your help and effort, can we get option to have multiple route for the automation like the below example.
trigger – motion sensor
Condition ( Yes and NO )
If door is open - Yes - turn off light
If door is open - NO - turn on light
can we get something like this
alias: Yes you can
description: ""
mode: single
trigger:
- platform: state
entity_id:
- binary_sensor.bedroom_motion_sensor_active
to: "on"
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.front_door
state: "on"
sequence:
- service: cover.open_cover
data: {}
target:
entity_id: cover.bedroom_curtain
- conditions:
- condition: state
entity_id: automation.family_is_away_lock_front_door
state: "off"
sequence:
- service: cover.close_cover
data: {}
target:
entity_id: cover.bedroom_curtain
default: []
1 Like
Tinkerer
(aka DubhAd on GitHub)
3
There is already an if
option, allowing you to make this modification to fuatakgun’s code:
i am personally avoiding if
because unavailable
will fall into else
case, right?
Tinkerer
(aka DubhAd on GitHub)
5
It will, though I generally don’t have (local) sensors going to unavailable. If that’s happening to you then your system has problems.
some of my integrations (too old or tired to debug) are going into unavailable while starting up the system and awkwardly I am starting up too much ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=10)
123
(Taras)
7
alias: example
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor
to: "on"
condition: []
action:
- service: "light.turn_{{ iif(is_state('binary_sensor.door' 'off'), 'on', 'off') }}"
target:
entity_id: light.whatever
1 Like