Hey,
I have four working iOS actions setup. Each iOS action triggers it’s own automation. So four actions, four automations. I have this bright idea to clean things up by combining all four into one using something like “choose”. Because of how the triggers are setup I’m not sure how I would incorporate them into something like “choose”. I’m not stuck on using choose if someone wants to make a suggestion.
Current working automation for single action.
triggers:
- event_type: ios.action_fired
event_data:
actionName: front_door_lock
trigger: event
actions:
- if:
- condition: state
entity_id: lock.front_door
state:
- locked
then:
- action: lock.unlock
metadata: {}
target:
entity_id: lock.front_door
data: {}
else:
- action: lock.lock
metadata: {}
target:
entity_id: lock.front_door
data: {}
This is gonna be a syntax mess with wrong spacing everywhere. I just whipped it up to give an idea as to where I want to go. I’m just not sure how I can incorporate the ios action as a condition to action on. I only know how to do it as a trigger.
triggers:
- event_type: ios.action_fired
event_data:
actionName: front_door_lock
trigger: event
- event_type: ios.action_fired
event_data:
actionName: back_door_lock
trigger: event
actions:
- choose:
- alias: Front door
conditions:
- event_type: ios.action_fired
event_data:
actionName: front_door_lock
trigger: event
sequence:
if:
- condition: state
entity_id: lock.front_door
state:
- locked
then:
- action: lock.unlock
target:
entity_id: lock.front_door
else:
- action: lock.lock
target:
entity_id: lock.front_door
- alias: Back door
conditions:
- event_type: ios.action_fired
event_data:
actionName: back_door_lock
trigger: event
sequence:
if:
- condition: state
entity_id: lock.back_door
state:
- locked
then:
- action: lock.unlock
target:
entity_id: lock.back_door
else:
- action: lock.lock
target:
entity_id: lock.back_door