[Release] Advanced Hue Bridge Integration

Cool. Just thought id ask. I'm going to use it for holiday lighting synced with music. Just looking at available options to automate the whole thing.

Still impressive all the functionality.

Interesting. So you would use it to start the music and the play. And would it also pick the effect, or whatever hue calls it? This sounds like something along the lines of my type of use case. Maybe I should get one to see how that works. I have the outdoor spots, and a flood... I was going to use an app, but if the hue play sync can do this well that might be an option.

Yup that the general idea. I know hubitat can do lighting effects however this seems a good way to keep the load off the hubs whilst my holiday lights get in the spirit.

Just looking for the cleanest way to implement so am checking all the options.

Head's up, if anyone is using this. I found a couple bugs in the Hub device. For the on/off state, it would flip-flop between on and off after each refresh, due to the hue hub reporting "on:false". Now the hub device only looks at the anyOn/allOn property based on the selection in settings. I also updated the logging so it actually logs more than refresh data. Additionally, the logic to compute on state did not work for any/all.. it simply accepted both, and relied on the last value -- now it sets the state correctly based on the any/all setting.

This has been fixed. You can now put in any number of seconds from 1 to several thousand.

Additionally, I have create debug logging and informational logging for groups now, and more formally standardized the logging structure.

1 Like

I just learned that the Groups are behaving the same way. This is rather new behavior from Hue. They incorrectly report all groups as off, even when they are on. It would seem that the "any on" and "all on" attributes are the only ones being used by Hue now for groups (Rooms and Zones). This has been fixed, and consequently, the Any On / All On logic was improved to no longer rely on the on value. Next up, I am working on a Scene manager.

1 Like

If anyone his using this, the code was updated again. We found I left some test code in place that was spitting out erroneous debug logging. Additionally, I accidentally introduced a potential number conversion error in the logs for some users that has been fixed. And finally, when I fixed the on/off flip-flop issue, I left out a critical refresh call on save of settings, to get auto-refresh running -- this has been corrected.

1 Like

Released version 1.4.0

This should be the final stable release for control of Lights, Groups, and Scenes. All logging has been standardized, and cleaned up. All reported bugs have been fixed. With basic informational logging, the application and drivers should not report any errors, and should only report changes to attributes/state of the devices. Turning off informational logging should silence all logging.

Understand that I do not own at least one of each of the Hue products, and cannot guarantee any release is 100% free of issues. This release works as expected on my system. There are still some very minor quirks that I need to work through, but they should not impact the usability of this product. Such ah, turning on a scene (as a child switch) then turning off a light in the group, this does not change the group's attributes, so the scene continues to show as being on. This has to do with what Hue reports as the state of the group. I will continue to add enhancements to work around such limitations.

1 Like

Not really. This is what the track scene State does. When track scene state is enabled, it takes a proactive approach at determining if the scene is no longer in effect, which is determine by any change to the group for which the scene belong. Because the light is not dependent on the group, the change to the light state does not track properly.

Consider a scene called casual reading. When “living room / casual reading” is activated, it turns off all living room lights except one end table light. If I then turn on the floor lamp, the scene is no longer active with track scene state enable, because that combination of lights is not the definition of the scene. Hue Hub will not report that there was a change to the group, since the change was an on/off state, So now I am correctly reporting the scene as on. Next, I can turn the end table light off, here again, the group does not change on Hue Hub? So I am not notified that the scene a really really off. Not only are all lights not in the state of the scene, the key lights aren’t... I have some enhancements I am working on to actually do like the scenes and groups does to determine if the scene is on by looking at all the members of the scene... essentially, a check to see if the hue scene definition matches the group’s current state. Then if you manually set the lights in the group to the setting of the scene, the scene will report as active, even though you did not explicitly turn the scene on.

If you want a scene to stay on once activated, regardless of the scene’s members current state, just turn off track scene state.

1 Like

I don’t use HE Dashboards. I don’t like the look or the interface. I use SharpTools.io

The dashboards do support custom CSS, which is what you are linking to. Since a color bulb sets the icon background to a color, it should be possible to have the CSS for the tile refer to the bulb’s background, or simply to resize and reshape the bulb’s round background to fill the tile... but other than that, I wouldn’t know.

2 Likes

Hi @armand,

First of all, thank you for all your work. I have been using AHBI for a couple of weeks now, with no problems.
However, today I'm trying to add some more bulbs and I'm getting an error:

In the logs:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[5]' with class 'java.util.ArrayList' to class 'java.util.Map' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.util.Map(java.lang.String) on line 283 (addLights)

I have two Hubitats, connected to two Hue Bridges. On all four instances I'm getting this error.
I have tried adding different types of Hue bulbs, all ending in error.

Using the latest versions of all software.

Could you please guide me in a direction to find the solution for this?
Thank you in advance.

Sorry. I am fixing this. This code was not supposed to be deployed. I accidentally published a refactoring I am working on. I will have the fix published in the next hour.

I fixed the bug. There is still a known issue where the code incorrectly allows you to pick hue scenes to import that are already imported. I will fix that next.

Please update your app.

Thank you for your rapid response and solution! it's working again.
I can live with the scene bug :slight_smile:

All I get is this after installation

app:662020-10-15 11:44:22.220 errorunauthorized user

app:662020-10-15 11:44:17.009 errorunauthorized user

app:662020-10-15 11:43:46.867 errorunauthorized user

app:662020-10-15 11:43:38.137 debugSearching for Hub additions and updates

app:662020-10-15 11:43:37.148 errorbody contains invalid json

app:662020-10-15 11:43:36.085 debugSearching for Hub additions and updates

app:662020-10-15 11:43:29.214 debugSearching for Hub additions and updates

app:662020-10-15 11:43:27.378 errorbody contains invalid json

app:662020-10-15 11:43:21.383 errorbody contains invalid json

app:662020-10-15 11:43:15.347 errorbody contains invalid json

app:662020-10-15 11:43:09.251 errorbody contains invalid json

Having the same issue!

I see the issue. It’s during hub linking. Give me a a few hours and I will post the fix.

@cory and @zapbust,

This is fixed. Hue expects a very Strict JSON body, and in my refactoring to simply the code, I convert the body to standard JSON, but failed to test it was still working. Every other Hue call that I tested with with this change except the link step, worked fine. It should work for you now.

Please update

1 Like

Success,

Thank you

Update the application component to fix a bug. When all lights in a group turn off, the group was not turning off, and when any (or all) lights in a group turn on, the group was not turning on. Now the groups reflect the state of the device change.

Please try to avoid using the group auto-refresh. It is better for the hub to only use the hub refresh. The group refresh option is for specific use cases where you only need (for instance) to refresh all the device states every 30 seconds, but you have a certain group that needs a more responsive refresh, because you update it outside of HE.

The biggest feature of this driver is the ability to proactively refresh every device state after any device state changes, so if you never use update Hue except the HE, then you can turn off all Hue refreshes, and it will still do a very effective job of keeping state.

1 Like