Hi there
I have some groups and subgroups of lights that I can control, in addition to each light individually, however this groups aren’t HA groups.
The groups are configured in the lights hub because in an HA group it will trigger each light of that group which have a noticeable delay unlike the light hub that broadcast the command turning on/off all the lights instantaneous.
So, for HA the groups are just a simple MQTT light.
Now, I tried to create a python script in AppDaemon to sync the lights states in HA, I mean, if I turn on the lights of one group, I want to change the state to “on” of each subgroup of that group and each individual light. I wanted to make use of set_state to change just the internal state in HA without triggering the command to change the lights.
However, this is getting a behavior that I was not expecting:
When I trigger the group (Living Room Back), as excepted, the script is executed and change the state of the 2 subgroups (Living Room FB and B) but then I cannot change that subgroups internal HA state again although the actual lights change the state.
If I turn off the group, the subgroups turn off also and everything seams ti work again.
The script for now is just this:
import appdaemon.plugins.hass.hassapi as hass
class LivingRoomLightsSync(hass.Hass):
def initialize(self):
self.listen_state(self.state_change, "light.living_room_back")
def state_change(self, entity, attribute, old, new, kwargs):
self.set_state("light.living_room_fb", state=new)
self.set_state("light.living_room_b", state=new)
Just some aditional information:
- In AppDaemon HADashboard this seams to work as expected.
- I’ve Hass.io installed with the version 1.31, with the previous version the behavior was the same
- I’ve this lights configured as MQTT lights
I thank you in advance for all the help you can give me.