Hi, sorry if this is a dumb question, apparently I can’t think of the right search terms.
I have some switches (one for lights one for curtains), the code for which is like 80 lines each… And I would like to have multiple switches that behave exactly the same… ie a curtain and light switch by the door, and a curtain and light switch by the bed… Is there a way of defining multiple switches (binary sensors) to essentially be the same?
That should work tho’ I’m not sure with events, it works for other types of triggers.
For instance…
- alias: 'Plant Battery Check'
initial_state: off
trigger:
- platform: numeric_state
entity_id: sensor.miflora_bird_of_paradise_battery, sensor.miflora_trailing_plant_bathroom_battery, sensor.miflora_volcano_fern_battery, sensor.miflora_flowering_fern_battery
below: 5
above: 1
action:
# Actions are scripts so can also be a list of actions
- condition: sun
after: sunset
- condition: time
after: '06:00:00'
before: '06:01:00'
- service: notify.mypushbullet
data_template:
message: >
'{{ trigger.from_state.attributes.friendly_name }} NEEDS a new Battery!'
So I just tried with a comma, and the result was that the automation stopped working, for the original switch as well.
I also tried adding additional platform: events, which didn’t work until I realised I needed to add -'s in front (which you did mention). So got there in the end! Though it still seems pretty bloated to add 5 lines per switch instead of just listing the entity_id’s but whatever!