I have two environments. One running openhabian (shop) and another in a docker container (home).
Aggregate functions are not working properly in my docker container. Both environments running 3.4.4. Unsure if it is new or related to the migration which happened in the last few weeks. The API shows that these two tests groups are identical.
I don’t really know where I should start troubleshooting. But I kinda want do some sort of export and wipe of the database (I have some scripts I use to pull in basic data using the API). Any thoughts?
Which one is which? About all I can say is the screen shot on the bottom is correct and the screen shot on the top is incorrect.
Screen shots of text are basically unusable so I’ll just have to take your word for it that they are the same.
What happens when you toggle the members of the Group? If one is ON does the Group turn OFF?
Note: upon zooming in there is one big difference between home and shop. Home’s Group’s state is NULL and shop’s Group’s state is ON. The NULL indicates either the aggregation function is wrong, or the members of the Group haven’t received an update or change since being added as members to the Group.
I know screen shots are lame, but it was the easiest way to show that the two freshly created group items of two items (six items total) between two environments were basically the same when their API output was compared against each other.
Here are logs of me toggling the child items in both environments.
Home: Problem Environment Logs:
2023-07-14 09:53:33.173 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test2' received command OFF
2023-07-14 09:53:33.173 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test2' changed from ON to OFF
2023-07-14 09:53:38.202 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test1' received command ON
2023-07-14 09:53:38.203 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test1' changed from OFF to ON
2023-07-14 09:53:38.866 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test1' received command OFF
2023-07-14 09:53:38.866 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test1' changed from ON to OFF
Shop: Functional Environment Logs
2023-07-14 09:54:26.971 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test1' received command ON
2023-07-14 09:54:26.985 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'Test3' changed from OFF to ON through Test1
2023-07-14 09:54:26.990 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test1' changed from OFF to ON
2023-07-14 09:54:27.362 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test1' received command OFF
2023-07-14 09:54:27.365 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test1' changed from ON to OFF
2023-07-14 09:54:27.367 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'Test3' changed from ON to OFF through Test1
2023-07-14 09:54:30.388 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test2' received command ON
2023-07-14 09:54:30.392 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test2' changed from OFF to ON
2023-07-14 09:54:30.396 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'Test3' changed from OFF to ON through Test2
2023-07-14 09:54:32.272 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test2' received command OFF
2023-07-14 09:54:32.284 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'Test3' changed from ON to OFF through Test2
2023-07-14 09:54:32.292 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test2' changed from ON to OFF
2023-07-14 09:54:35.146 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test2' received command ON
2023-07-14 09:54:35.151 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test2' changed from OFF to ON
2023-07-14 09:54:35.153 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'Test3' changed from OFF to ON through Test2
2023-07-14 09:54:38.161 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Test1' received command ON
2023-07-14 09:54:38.178 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test1' changed from OFF to ON
Although shown in the API how the aggregate functions work, here are screen shots from the two environments:
and just to rule out that it had anything to do with docker, I spun up another instance and created these three items which worked just fine (as I expected them to).
Yeah, sadly nothing in openhab.log. Both groups were created fresh to make sure there wasn’t something else impacting the behavior. Thanks for offering some ideas… I think I am going to use the API to move 300 things and 2000 items to a fresh environment and see what happens.
I’ve never seen anything like this reported before so I’m at a loss. I’m not totally sure there is even enough here to file an issue. But something is clearly wrong so it might be worth.
You might also try in OH 4. Lots has changed so even if there is a bug here, it’s unlikely to get fixed in OH 3.4 or it might already be fixed .
I suspect it has to do with years of cruft in my files, and the migration to docker somehow… I don’t think it is truly a bug, but I’m not sure how to troubleshoot so I’m going to just use this as a reason to do a fresh install. Not going to jump to 4 yet, however.
I migrated all of the items and things using the API and ‘create from text’, cleaning up and renaming everything I wanted to (not much).
The problem still exists.
If I create these items in my ‘shop’ environment, they work as expected (I have video). However not in my ‘home’ environment (video as well).
If I use the API to iterate through all the items and delete them so I have ZERO items and then create these three items in my ‘home’ environment, they still do not work properly.
Tomorrow I may test the latest 4.0 snapshot. I do not know where to begin troubleshooting this issue (links?).
Thanks Rich. I stopped the docker container and deleted the image so it pulled the 4.0 image. Works as expected. Go figure. Now I need to sort out everything that 4.0 broke. Busy time of year for me to be dealing with strange problems so my attention is split. For whatever it is worth, here are the item definitions I was using in both environments to replicate the issue:
Group:Switch:OR(ON,OFF) gDelete "Active Lights [%d]" // e.g. ON and "2"
Switch Delete1 "Delete1" (gDelete)
Switch Delete2 "Delete2" (gDelete)
For whatever it is worth, I rolled back to 3.4.4 while trying to sort out some HABApp errors. Even though the items worked properly in 4.0, they did not when rolled back to 3.4.4. Thanks to @Spaceman_Spiff for helping me through that issue so less errors in the logs, but not everything has been tested yet.
It’s really odd behavior and I have nothing left to offer for how or why. I’m glad what ever it is was somehow fixed in OH 4 but have nothing left to suggest for 3.4.
Yes! Me too. I am all for moving on. Hopefully it seems the 4.0 doesn’t incur more pain than this issue did. I just felt like this one last test was worth reporting in case anyone found interesting… 3 days before going away so hope to get stabilized.