I want to turn on all of my lights in a certain room. When I arrange those lights in a group and set this group to ON, the lights turn on sequently with some millis delay.
When i turn this group on via my hardware hue switch the all turn on together since a request is send to a hue group.
I actually just thought of something that may work but Iām sure and Iām also not sure it would meet your needs.
But if you create a timer to trigger the lights 10-100 msec into the future for each of the lights maybe they will execute a little closer to the same time.
rlkoshak thanks for your code, there were some typos so here a update if someone wants to use it. Indeed it improved the situation, but still the lights wonāt switch on in perfect synchro
That is very likely easier said than done. Groups are managed and maintained by the core, not the Hue binding. There may be a way for the Hue binding to allow one to create an Item that represents a group of lights, but the Hue binding has no control over how Groups are processed.
I also think this would be very useful. I dont have any need for individual lights in OpenHab as I dont control them individually on a day by day basis. Id rather define scenes and then call upon Hue Groups to active different scenes. I wish it could be done with the Hue bindingā¦ A manual hack could be to get your API key from Hue Bridge and use the exec binding to perform calls directly to the RESTful interfaceā¦ I do this now to turn off and on all lights.
Iām baffled that this isnāt already implemented. Although I understand supporting groups in addition to individual lights might be a tad complex, considering their connection.
I might quickly look into modifying the Hue binding to deal with groups instead of lights. That would mostly resolve it on my part. I have no need for individual control over bulbs, since all my bulbs are part of groups.
Just setting up my hom automation again in the flat and getting to the same point where i want to switch on and off a group of lights.
Since I donāt like the sequential on/off when using openhab group: Is there any progress on the binding with added group support? Or should I write a function to send a put request to HUE Api for the group?
I solved this one by setting a switch for each room. Based on this switch status I sent my own request to the Hue API. All you have to find is your group id in the hue api. In the example below 7
var String hueApiCall = "curl@@-X@@PUT@@-d@@{\"on\": %s}@@http://192.168.0.11/api/your api key/groups/%d/action"
rule "Light Kitchen" when
Item Lights_kitchen received command
then
if( Lights_kitchen.state == ON ){
// Turn group on
executeCommandLine(String::format(hueApiCall,"true",7))
}
else{
executeCommandLine(String::format(hueApiCall,"false",7))
}
end
To keep track of the status if the group I have another openhab group and change the status of the switch accordingly
Group:Switch:OR(ON,OFF) gLights_livingroom
Group:Switch:OR(ON,OFF) gLights_bedroom
Group:Switch:OR(ON,OFF) gLights_kitchen
Group:Switch:OR(ON,OFF) gLights_guestroom
Group:Switch:OR(ON,OFF) gLights_auto
[....]
// Switches to turn off/on all lights in Room
Switch Lights_guestroom "Guestroom Light"
Switch Lights_livingroom "Livingroom Light"
Switch Lights_kitchen "Kitchen Light"
Switch Lights_Bedroom "Bedroom Light"
[...]
rule "Update Light Switches" when
Item gLights_livingroom changed or Item gLights_kitchen changed or Item gLights_guestroom changed or Item gLights_bedroom changed
then
Lights_guestroom.postUpdate( gLights_guestroom.state )
Lights_Bedroom.postUpdate( gLights_guestroom.state )
Lights_livingroom.postUpdate( gLights_livingroom.state )
Lights_kitchen.postUpdate( gLights_kitchen.state )
end
Thanks for that. The rule generally works, but i am still experiencing that the group of lights is not being updated correctly. But there is no error in the log. When i switch of the lights via openhab app on my mobile, it is going back to āonā a few seconds later.
any idea what might cause this?
Does this also works when youāve already defined the individual items (as āstand-aloneā units)?
Would be interesting to prevent the default group-behaviour.