That’s entirely due to how you’ve designed the automation, not how the group is created.
Whether you create the all_trackers group manually (like pollinolas suggested) or dynamically (like gazzaman2k suggested) the end-result is identical: it’s a group containing two device_trackers.
Go to Developer Tools > States and look at the group generated by the script (group.all_devices). How does it differ from a manually defined group like the one I posted above?
The only factor that could cause different group behavior is the all option. Otherwise, given a group’s default options, whether the group is defined via script or manually, the end-result is the same kind of group behavior.
How do I make this work again? the easy way please. I dont think people should have to make this more complicated just because some $#%^&* decided it was better… (pardon my french as I am slightly agitated of me having to fix a thing that was perfectly fine to begin with… again.)
looking all the options I have above in this topic I can either make a script or start adding all the lights. thats just great…
It consists of one automation and one python_script. That’s it, that’s all. Easy-peasy.
That one python_script can be used to make a group containing all lights, or all switches, or all locks, or whatever other domain you want. So if in the future you need a group.all_covers you only need to append this to the automation:
erm yeah… I have a button by my bed that is the “bedtime” switch. Turns off ALL light and various switches… I was wondering why my lights didn’t go off…
Hi everyone. Sorry for my ineptitude with both Home Assistant and Python, but what would be a quick equivalent of this code?
# add all the switches with "relay" in their name
group_entities = hass.states.get('group.all_switches').attributes['entity_id']
timer_entities = []
for e in group_entities:
if "relay" in e:
timer_entities.append(e)
# append light entities
timer_entities.extend(hass.states.get('group.all_lights').attributes['entity_id'])
I was having a check in Node-Red to send me a telegram message with (yes/no replyback) asking if I want to turn off the lights if I’m not home and if any of the lights are on… I was using the the current state of group.all_lights to check if any of the lights was on which doesn’t work now.
I could follow approaches like the one to create groups (via scripts) when HA starts but it is another bespoke workaround configuration… I guess we should aim simplification no? otherwise our configuration files will become each time more complex which will lead to harder maintenance (especially when new releases come with more breaking changes)
True… actually is what I’m using now. Although the flexibility that we have is great and allow for all that I was just wondering if it was really the right move because we are just creating more dependencies on the config which with time will make it harder to mantain.
In other end I also kind of understand we can’t support in core all possible features.
I applied this to a template sensor since I want to display how many lights thats turned on in a view. However it looks like the sensor is not updated when I turn on and off lights. Is that normal and if so, is it possible to make it update frequently?