Can anyone point me in the right direction here - tried searching, tried a few things and having trouble finding the right syntax…
I want to create a custom component that listens for state changes of a group of sensors. The sensors are already grouped - i.e. in my group.yaml I have something like:
mysensors:
name: "My sensors"
entities:
- sensor.sensor1
- sensor.sensor2
etc…
I can get my custom component working if define it in configuration.yaml like this:
my_custom_component:
sensors:
- sensor.sensor1
- sensor.sensor2
And then in the custom component python code:
sensors = config[DOMAIN]['sensors']
And:
track_state_changes(hass, temperatures, state_changed)
What I’d like to do is configure my component like this:
my_custom_component:
sensor_group: mysensors
That way I don’t have to repeat my sensor list (DRY and all that!)
Then in the code:
sensorgroup = config[DOMAIN]['sensor_group']
My question is how do I expand that group to its list of entity_ids to pass as the array to track_state_change?
I’m hoping it’s something really obvious that I’ve missed, but I can’t seem to figure out how.