I have the habit of putting multiple triggers into automations and using if conditions to control what is being done depending on the trigger. I do this to reduce the number of components for every solution by only needing one automation rather than 2 or 3.
Is this a bad habit that may cause issues that I may not think about? I do consider multiple calls and the possible need to change mode to e.g. queued.
An example (never mind the mismatch of entity with name of automation):
alias: Mattress safety timer handler
description: ""
trigger:
- platform: state
entity_id:
- light.studio_window
to:
- "on"
- "off"
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.mattress_safety_timer
condition: []
action:
- if:
- alias: Check if on/off trigger
condition: template
value_template: "{{ trigger.idx == \"0\" }}"
then:
- alias: Handle on/off events
if:
- condition: template
value_template: "{{ trigger.to_state == \"on\" }}"
alias: Check on/off
then:
- service: timer.start
metadata: {}
data: {}
target:
entity_id: timer.mattress_safety_timer
else:
- service: timer.cancel
metadata: {}
data: {}
target:
entity_id: timer.mattress_safety_timer
else:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.studio_window
enabled: true
mode: single