Has anyone requested anything relating to component Association that would help simplify complex automation? For example, you have living room and and with those room, you have lights, motion me all lights and media player in the room. Basically , based on sensor trigger to action to call some thing like trigger.attribute.lights or trigger.attribute.media_player to turn on and off.
So groups?
So group can turn things on and off together but I can’t see how you can use automation trigger of different sensors and action another device that belong to their respective groups. Ie.
You have:
Sensor A associated with light A and media player A
Sensor B associated with light B and media player B
Sensor C associated with light C and media player C
What I want to do is one Automation to turn on:
If sensor A is on, then turn light A and media player A
If sensor B is on, then turn light B and media player B
If sensor C is on, then turn light C and media player C
Again, the key here is one automation rule to do this.
I think you can do this using templates currently.
A trigger is a trigger. Trigger happens, action follows. Whether the sensor is grouped with the room it’s in is irrelevant.
As above, a service_template that matches sensor A to group A is easily achieved.
Set friendly name of sensor A to ‘a’ and sensor B to ‘b’ and voila…
group:
a:
entities:
- light.a
- switch.a
b:
entities:
- light.b
- switch.b
automation:
trigger:
platform: state
entity_id: sensor.sensor_a, sensor.sensor_b
to: 'on'
action:
service_template: homeassistant.turn_on
data_template:
entity_id: 'group.{{trigger.to_state.attributes.friendly_name}}'
I’ve thought about a similar thing as it pertains to people. E.g. if wife arrives home, notify wife. Right now what I do is create a template that uses trigger.entity_id
and an if statement.