Group status updating from top-down but not the other way

Greetings all,

First of all a huge thanks for the effort put in on this excellent UI. It’s mission-critical for the WAF!

I’m stuck however with HabPanel updating higher-level icons with the correct status in with groups.

I have a light (Study) which belongs to the group ‘Indoor Lights’, which in turn belongs to the main group ‘All Lights’.

Switching the groups on / off has the correct effect ‘top-down’, I.e. If I switch ‘Lights’ off, the group ‘Indoor Lights’ status is set to ‘off’ and the light status is set to ‘off’. This is behaving as expected.

However, if I switch the group ‘Indoor Lights’ on or off, the group status for ‘All Lights’ is not updated. In other words, in the case where there are no lights on in a group, the status of the associated higher-level / associated group is not updated.

So it seems that not all arrays containing the item (Study light) are updated with a change.

I will try to clarify with illustrations…

1- The Study light is on when ‘All Lights’ is set to ‘on’:

2- Switch off ‘All Lights’ and the ‘Indoor Lights’ panel and the ‘Study’ lights icons are set to ‘off’. No issues there.

3- Now the problem… When I set the ‘Study Light’ switch on, the status change is not updated to the respective groups to which the study light belongs. In this case they remain ‘off’ even though one of their members is on.

Is the problem maybe in my items definition?

/* Lights */
Group:Switch:OR(ON, OFF) Lights_All 		"All Lights [%d]"		<light>
Group:Switch:OR(ON, OFF) Lights_Indoor 		"Indoor Lights [%d]"	 	<light>		(Lights_All)
Group:Switch:OR(ON, OFF) Lights_Outdoor 	"Outdoor Lights [%d]" 		<light>		(Lights_All)

Color 			Light_Study 		"Study Light [%d %%]"		<light>	        (Lights_All, Lights_Indoor) 	{ channel="lifx:colorlight:D073D51407BC:color" }
Temperature 	        Light_Study	 	"Study Light [%d %%]"	        <slider>	(Lights_All, Lights_Indoor)	{ channel="lifx:colorlight:D073D51407BC:temperature" }

Has anyone else suffered a similar fate?

Not sure it’s a problem with HABPanel, does this happen with the other UIs as well?

Good point. I’ve done a similar comparison in the Basic UI of the steps shown above.

The results are different, but also incorrect (mostly!).

1- After a restart of OH, the physical bulb is off. Basic UI shows this in the groups, but the ‘Study’ icon is ‘on’ (although the slider is correctly at 0).

HabPanel is correct:

2- I switch ‘All Lights’ on, the light comes on. Basic UI however get’s it all wrong: The ‘All Lights’ icon goes off, ‘Indoor Lights’ is on, the ‘Study’ icon remains on but the switch goes off, but the slider is correct.

HabPanel is correct:

3- So now I hit the study light switch (currently in ‘off’ but the light is on), and it bounces back to ‘off’, and the physical light remains off. This remains no matter how many times I hit the switch.

Over on HabPanel I hit the Study switch and it correctly updated it’s Icon to ‘off’ and the light goes off. However, the status of the respective groups are not updated as per my original post,

In the Basic UI the groups were updated correctly to ‘off’, (though the Study light icon remained ‘on’, the switch is ‘off’ and the slider is still ‘on’).

4- The from Basic UI I press the Study switch to turn the light on, it does so, but after a split second the Switch icon returns back to the ‘off’ position, the group icon ‘Indoor Lights’ comes on but the group icon ‘All Lights’ remains off.

So it seems there’s some kind of inconsistency in the behaviour. Apologies for posting in the HabPanel section as it appears to be some other issue.

In Basic UI, the behaviour is as follows:
All Lights

  • Toggles the light on and off but it’s icon remains permanently ‘off’.
  • It toggles the ‘Indoor Lights’ icon correctly.
  • Has no effect on the Study icons at all (light icon, switch or slider)

Indoor Lights

  • Toggles on it’s own light icon.

  • Has no effect on either ‘All Lights’ nor ‘Study’

Study

  • Toggles the light icon in ‘Indoor Lights’ but not ‘All Lights’.

  • When switched off, the slider remains as if it was on.

  • HabPanel still controls the light correctly at this stage.

I’m running OH2 on Windows 10.

I simplified the items definition for the LIFX to only contain the color channel as I think it only needs the one.

So it looks like this:

Group:Switch:(ON, OFF) Lights_All 	"All Lights [%d]"	<light>
Group:Switch:(ON, OFF) Lights_Indoor 	"Indoor Lights [%d]"	<light>	(Lights_All)
Group:Switch:(ON, OFF) Lights_Outdoor 	"Outdoor Lights [%d]" 	<light>	(Lights_All)

Color	Light_Study 		"Study Light [%d %%]"		<light>	(Lights_All, Lights_Indoor) 	{ channel="lifx:colorlight:D073D51407BC:color" }

From my sitemap:

	Frame label="All Lights"{
		Switch item=Lights_All mappings=[OFF="All Off", ON="All On"]
		Switch item=Lights_Indoor mappings=[OFF="All Off", ON="All On"]
	}
     	Frame label="Lights" icon="light"{
		Switch item=Light_Study label="Study"
		Slider item=Light_Study label="Study"
	}

Could you fathom a guess at the nature of this problem?

I’ll then try move this to the relevant section.

Thanks

Hi

I have th same issue.
Would really be nice, when the group would change the status bottom up-

THX

I do question what you are trying to get!
IMHO having a group switch shall allow to switch ALL members to ON or OFF. The switching of a single member however shall NOT influence other members, why should the group switch indicate such a individual action? What would be the correct indication for a group switch if two members are on and two others are off?

Hi @opus,

You are correct about how a group switch should work.

What the issue is is that there is no ‘bottom up’ status update as @Daniel_OH put it. That one line explained the issue a lot better than I did!

The actual issue may be best described by way of an example taken from the Hue app which provides the functionality we’re asking for.

  • Everything is off - all good

  • Switch on one light and the ‘room / group’ shows that there is at least one light in the group ‘ON’. This ‘bottom-up’ status update on the group switch does not happen in OH2 which is the issue.

The same chain of events in OH2:

  • Everything is off - all good

  • Switch on one light and the ‘room / group’ does not reflect that there is at least one light in the group that is ‘ON’. So now the group switch cannot effectively switch the group off as the switch is not aware that anything in the group is ‘ON’. The third step in the Hue process above as such is not available in OH2.

I hope that illustrates the issue a bit better.

Edit: As an addition, the LIFX app provides the same functionality that the Hue app does in that the group switch is aware of the collective status of all it members

That is a bit more complicated to incooperate!
Actualy a switch has an associated Icon that Shows the state of the group switch and not the state of (some) members of the group.
For the display:
In order to display if at least one lamp is on, you would need a group contact, which is on whenever at least one group member is on.
For the switching:
IMHO a rule would be needed, which is triggered on the switch command and which is checking weather the contact is ON (in this case send OFF command) and vice versa. In this case that switch wouldn’t be linked to the Group directly!

I was thinking along similar lines, but thanks for giving me the idea of implementing a contact as it hadn’t occurred to me :wink:

What I thought was to write a script that is called for every light switch event to go and check the status of each member of a group and send the postUpdate to the group switch accordingly. I was worried however that this approach could quickly get messy as groups can be part of bigger groups etc. Your solution would be cleaner.

Would anyone have an idea how this could potentially be built into core functionality?

I’ll work on the rule and see if I can get it right. I’ll post it up here asap.

Comment on possible area for investigation.

The Groups are defined of type Switch. OR(ON, OFF) says the Group should display as ON if any of its members are ON. So far, so good.

But in this case, the groups have members which are not simple Switches but are dimmers. The group’s logic has to do work (guess? estimate?) to convert settings into ON/OFF states.
It might be interesting to see if you get the same problem behaviour with groups of simple switch types.


The top level group-of-groups has members some of which are sub-groups, some of which are lights.
The lights are members of sub-groups, but also members of the top group in their own right.
The top group therefore “includes” each light twice in a wrong-seeming fashion, maybe that’s where things go bad.

I would reconfigure so that lights only belong to sub-groups, and top group only contains sub-groups.

So I’ve got the functionality pretty much working perfectly by using proxy dimmers for the lights I want to group. I’m not sure if this is best practice but it works well so far.

The setup looks like this…

ligth.items

/* -----------------Groups---------------- */
Group:Dimmer:OR(ON,OFF) Lights_All			"All Lights [%d]"			<light>
Group:Dimmer:OR(ON,OFF) Lights_Outdoor		"Outdoor Lights [%d]"		<light>		(Lights_All)
Group:Dimmer:OR(ON,OFF) Lights_Indoor		"Indoor Lights [%d]"		<light>		(Lights_All)

/* -----------------Lights----------------- */
// Outdoor
Dimmer Light_Kitchen_Porch		"Kitchen Entrance [%d %%]"		<light>		(Lights_Outdoor)	
Dimmer Light_Braai 				"Braai [%d %%]"				    <light>		(Lights_Outdoor)	
Dimmer Light_Adi_Deck			"Adi's deck [%d %%]"		    <light>		(Lights_Outdoor)  	
Dimmer Light_Backyard 			"Back yard [%d %%]"			    <light>		(Lights_Outdoor)
Dimmer Light_Patio_1			"Patio 1 [%d %%]"		   		<light>		
Dimmer Light_Patio_2			"Patio 2 [%d %%]"		   		<light>		
Dimmer Light_Patio				"Patio [%d %%]"			    	<light>		(Lights_Outdoor)
Dimmer Light_Front_Door_1		"Front Door 1 [%d %%]"		   	<light>		
Dimmer Light_Front_Door_2		"Front Door 2 [%d %%]"		   	<light>		
Dimmer Light_Front_Door			"Front Door [%d %%]"			<light>		(Lights_Outdoor)

// Indoor
Dimmer Light_Study 				"Study [%d %%]"				    <light>		(Lights_Indoor)
rule "Switch lights on at night"
when
	Item NightState changed 
then
	if (NightState.state == OFF) {
		logInfo("Daytime", "--> Lights " + NightState.state)
		sendCommand(Lights_All, OFF)
	} else {
		sendCommand(Lights_Outdoor, 40)
		logInfo("Night time", "--> Lights on")
		sendCommand(Light_Study, 40)
	}	
end

rule "Adjust lights late at night"
when
	Item LateNightState changed to ON
then
	logInfo("Late at night", "--> Outside lights on full")
	sendCommand(Lights_Outdoor, 100)
	sendCommand(Light_Study, OFF)	
end

rule "Update patio lights"
when 
	Item Light_Patio changed
then
	val SliderValue = Light_Patio.state as Number 
	sendCommand(Light_Patio_1, SliderValue)
	sendCommand(Light_Patio_2, SliderValue)
end

rule "Update front door lights"
when 
	Item Light_Front_Door changed
then
	val SliderValue = Light_Front_Door.state as Number 
	sendCommand(Light_Front_Door_1, SliderValue)
	sendCommand(Light_Front_Door_2, SliderValue)
end

It’s almost there, until I introduce a ‘global dimmer’ :frowning2:

It’s got the 100% bouncy issue which was raised raised some time ago here… Light Slider goes to 100% even when light not 100%, but I see no item being updated to ‘ON’ in my logs…

2017-06-11 19:51:37.001 [ItemCommandEvent          ] - Item 'Lights_Outdoor' received command 57
2017-06-11 19:51:37.007 [ItemCommandEvent          ] - Item 'Light_Kitchen_Porch' received command 57
2017-06-11 19:51:37.010 [ItemCommandEvent          ] - Item 'Light_Braai' received command 57
2017-06-11 19:51:37.014 [ItemStateChangedEvent     ] - Light_Kitchen_Porch changed from 0 to 57
2017-06-11 19:51:37.018 [GroupItemStateChangedEvent] - Lights_Outdoor changed from 57 to 100 through Light_Kitchen_Porch
2017-06-11 19:51:37.019 [ItemCommandEvent          ] - Item 'Light_Adi_Deck' received command 57
2017-06-11 19:51:37.020 [GroupItemStateChangedEvent] - Lights_All changed from 0 to 100 through Lights_Outdoor
2017-06-11 19:51:37.023 [ItemCommandEvent          ] - Item 'Light_Backyard' received command 57
2017-06-11 19:51:37.029 [ItemStateChangedEvent     ] - Light_Adi_Deck changed from 0 to 57
2017-06-11 19:51:37.031 [ItemCommandEvent          ] - Item 'Light_Patio' received command 57
2017-06-11 19:51:37.034 [ItemCommandEvent          ] - Item 'Light_Front_Door' received command 57
2017-06-11 19:51:37.043 [ItemStateChangedEvent     ] - Light_Braai changed from 0 to 57
2017-06-11 19:51:37.045 [ItemStateChangedEvent     ] - Light_Backyard changed from 0 to 57
2017-06-11 19:51:37.046 [ItemStateChangedEvent     ] - Light_Patio changed from 0 to 57
2017-06-11 19:51:37.047 [ItemStateChangedEvent     ] - Light_Front_Door changed from 0 to 57
2017-06-11 19:51:37.085 [ItemCommandEvent          ] - Item 'Light_Patio_1' received command 57
2017-06-11 19:51:37.087 [ItemCommandEvent          ] - Item 'Light_Patio_2' received command 57
2017-06-11 19:51:37.090 [ItemStateChangedEvent     ] - Light_Patio_1 changed from 0 to 57
2017-06-11 19:51:37.092 [ItemStateChangedEvent     ] - Light_Patio_2 changed from 0 to 57
2017-06-11 19:51:37.147 [ItemCommandEvent          ] - Item 'Light_Front_Door_1' received command 57
2017-06-11 19:51:37.150 [ItemCommandEvent          ] - Item 'Light_Front_Door_2' received command 57
2017-06-11 19:51:37.151 [ItemStateChangedEvent     ] - Light_Front_Door_1 changed from 0 to 57
2017-06-11 19:51:37.153 [ItemStateChangedEvent     ] - Light_Front_Door_2 changed from 0 to 57
2017-06-11 19:51:38.324 [ItemStateChangedEvent     ] - Current_Time changed from 2017-06-11T19:50:38.316+0200 to 2017-06-11T19:51:38.316+0200
2017-06-11 19:51:43.073 [ItemCommandEvent          ] - Item 'Lights_Outdoor' received command 36
2017-06-11 19:51:43.078 [ItemCommandEvent          ] - Item 'Light_Kitchen_Porch' received command 36
2017-06-11 19:51:43.080 [ItemCommandEvent          ] - Item 'Light_Braai' received command 36
2017-06-11 19:51:43.083 [GroupItemStateChangedEvent] - Lights_Outdoor changed from 36 to 100 through Light_Kitchen_Porch
2017-06-11 19:51:43.085 [ItemCommandEvent          ] - Item 'Light_Adi_Deck' received command 36
2017-06-11 19:51:43.086 [ItemStateChangedEvent     ] - Light_Braai changed from 57 to 36
2017-06-11 19:51:43.087 [ItemCommandEvent          ] - Item 'Light_Backyard' received command 36
2017-06-11 19:51:43.089 [ItemCommandEvent          ] - Item 'Light_Patio' received command 36
2017-06-11 19:51:43.091 [ItemCommandEvent          ] - Item 'Light_Front_Door' received command 36
2017-06-11 19:51:43.093 [ItemStateChangedEvent     ] - Light_Kitchen_Porch changed from 57 to 36
2017-06-11 19:51:43.096 [ItemStateChangedEvent     ] - Light_Adi_Deck changed from 57 to 36
2017-06-11 19:51:43.096 [ItemStateChangedEvent     ] - Light_Backyard changed from 57 to 36
2017-06-11 19:51:43.098 [ItemStateChangedEvent     ] - Light_Patio changed from 57 to 36
2017-06-11 19:51:43.099 [ItemStateChangedEvent     ] - Light_Front_Door changed from 57 to 36
2017-06-11 19:51:43.214 [ItemCommandEvent          ] - Item 'Light_Patio_1' received command 36
2017-06-11 19:51:43.216 [ItemCommandEvent          ] - Item 'Light_Patio_2' received command 36
2017-06-11 19:51:43.216 [ItemStateChangedEvent     ] - Light_Patio_1 changed from 57 to 36
2017-06-11 19:51:43.219 [ItemStateChangedEvent     ] - Light_Patio_2 changed from 57 to 36
2017-06-11 19:51:43.222 [ItemCommandEvent          ] - Item 'Light_Front_Door_1' received command 36
2017-06-11 19:51:43.225 [ItemCommandEvent          ] - Item 'Light_Front_Door_2' received command 36
2017-06-11 19:51:43.226 [ItemStateChangedEvent     ] - Light_Front_Door_1 changed from 57 to 36
2017-06-11 19:51:43.228 [ItemStateChangedEvent     ] - Light_Front_Door_2 changed from 57 to 36
2017-06-11 19:51:47.404 [ItemCommandEvent          ] - Item 'Light_Front_Door' received command 0
2017-06-11 19:51:47.409 [ItemStateChangedEvent     ] - Light_Front_Door changed from 36 to 0
2017-06-11 19:51:47.413 [ItemCommandEvent          ] - Item 'Light_Front_Door_1' received command 0
2017-06-11 19:51:47.418 [ItemStateChangedEvent     ] - Light_Front_Door_1 changed from 36 to 0
2017-06-11 19:51:47.419 [ItemCommandEvent          ] - Item 'Light_Front_Door_2' received command 0
2017-06-11 19:51:47.425 [ItemStateChangedEvent     ] - Light_Front_Door_2 changed from 36 to 0
2017-06-11 19:51:48.607 [ItemCommandEvent          ] - Item 'Light_Patio' received command 0
2017-06-11 19:51:48.611 [ItemStateChangedEvent     ] - Light_Patio changed from 36 to 0
2017-06-11 19:51:48.620 [ItemCommandEvent          ] - Item 'Light_Patio_1' received command 0
2017-06-11 19:51:48.623 [ItemStateChangedEvent     ] - Light_Patio_1 changed from 36 to 0
2017-06-11 19:51:48.626 [ItemCommandEvent          ] - Item 'Light_Patio_2' received command 0
2017-06-11 19:51:48.630 [ItemStateChangedEvent     ] - Light_Patio_2 changed from 36 to 0
2017-06-11 19:51:49.937 [ItemCommandEvent          ] - Item 'Light_Braai' received command 0
2017-06-11 19:51:49.941 [ItemStateChangedEvent     ] - Light_Braai changed from 36 to 0
2017-06-11 19:51:51.565 [ItemCommandEvent          ] - Item 'Light_Kitchen_Porch' received command 0
2017-06-11 19:51:51.570 [ItemStateChangedEvent     ] - Light_Kitchen_Porch changed from 36 to 0
2017-06-11 19:51:52.683 [ItemCommandEvent          ] - Item 'Light_Backyard' received command 0
2017-06-11 19:51:52.688 [ItemStateChangedEvent     ] - Light_Backyard changed from 36 to 0
2017-06-11 19:51:54.302 [ItemCommandEvent          ] - Item 'Light_Adi_Deck' received command 0
2017-06-11 19:51:54.306 [GroupItemStateChangedEvent] - Lights_Outdoor changed from 100 to 0 through Light_Adi_Deck
2017-06-11 19:51:54.306 [ItemStateChangedEvent     ] - Light_Adi_Deck changed from 36 to 0
2017-06-11 19:51:54.307 [GroupItemStateChangedEvent] - Lights_All changed from 100 to 0 through Lights_Outdoor

Here is the sample of the other updates working nicely…

If anyone could advise I would be most grateful.

Craig