[Release] Advanced Hue Bridge Integration

Works perfectly, just needed to add the scenes into HE, awesome work.

Actually one minor thing is the status (switch attribute) doesn't get updated to on when using the default scene option. Works when this isn't being used.

I've got both rooms and zones on the hue bridge, but currently testing with a room

1 Like

the status (switch attribute) doesn't get updated to on when using the default scene option. Works when this isn't being used

My intention was to allow any scene for the group to be turned on. Admittedly, in my final testing, I did not try this new feature against a group without any imported scenes. It may just be a logic error in my state parser. Basically, to get the best reliability I do not ever assume state for hue devices. Instead, I command a device or group than on the confirmation of success, I het data back that I then use to trigger a full refresh.

For scenes, I set a scene, but don’t change any state. The hub responds with confirmation the scene was set for the group. I take that confirmation and turn on the scene device, then command a refresh. If one is not found, I should still command a refresh. I can fix that.

I spoke a little too soon by saying the state didn't get updated, it just took quite a while in some cases. I'm thinking it might be a speed thing in terms of processing the request and the refresh, either on the HE side and/hue, not sure. I'll do some more testing later today.

It should update within 2 seconds (max). Otherwise it is failing back to the scheduled refresh of the group or the hub.

Then I would say in my case it is probably the latter. At times even the activation of the scene can be a lengthy delay.

I'm now starting to think it could have been a performance issue on my hub earlier, the changes in the lights and the state shown in he seem to be much more snappy.

This may not be related, but I see this error in the logs for some of the rooms I have brought in:

dev:16162020-09-26 03:25:09.281 errorjava.lang.RuntimeException: CronExpression '0/60 * * * * ?' is invalid. on line 145 (resetRefreshSchedule)

If activation of a scene is lengthy then you likely are flooding your Hue hub. I only recently learned about the volume limitation on the Hue hub when I was adding some of of these latest features, and as a result, I put in logic (very simplistic) to minimize volume cause by refreshing the hub.

Based on all of what I am reading, this is likely the case. I have five (5) rooms and three (3) zones defined in my Hue system. I have two Hue dimmers, and fifteen (15) bulbs of differing types -- four (4) of which are not presently online. Not a large system by any measure, but it is crazy fast. To make sure I am providing accurate information, I just double checked, and my Hub device is set to refresh every 20 seconds. My group "Office" is set to refresh every 10 seconds. All other groups (Rooms and Zones are both just groups in HE) do not have a refresh defined. When I command a change of one of my devices through HE, the action is immediate. I mean, from HE page, from click to action is about .5 seconds or less, and from SharpTools about the same (only a minor added delay of milliseconds), and all additional updates (like All Lights, Light 1, Light 2, Ceiling light) for related devices get updated in a more than reasonable amount of time.

My system wasn't designed for very long cycles between refreshes. I never was able to come up with a good way to manage this. 60 seconds is just as easily achieve with 59 seconds and you won't get this error. The cron scheduler is not very robust. I am still tying to come up with a good solution for this that works on all my scheduled devices. For now, keep down below 60 and you should be fine.

2 Likes

I believe this is better now. Try it out. Also, the logging has been improved to make it easier to follow what is going on.

1 Like

Thanks @armand, I have been testing some more this morning and things appear to be work as I would expect, scenes are activating, status' updating, etc, all quite snappy. Very happy!!! :slight_smile: :grinning:

Sorry for being a little all over the place with my feedback, I am sure the issues I saw were performance related, most likely flooding as you suggested. I have been able to get away with 10 second auto refreshes so far, but am still in the process of setting all the rooms up. I do have a significantly larger setup, I think its about 50-60 bulbs, plus about 20 or so accessories I would expect, so am already pushing the limits of the hue bridge.

Here's the settings I am using in most cases, a couple of rooms don't require the scene setup you added, but most are using these settings:

I suspect if you want to set 60 seconds for the refresh, i.e. 1 minute, perhaps this needs to be a 1 in place of the zero (1/0)? I've only used cron a few times, so not sure. But yes, setting it back below 60 stopped the error appearing, thanks.

EDIT: Found the spot for my request below, it appears to be the debug logging switch in the app settings. All good.

Only other suggestion / request, I couldn't see a spot to remove some of the info logging for the regular refreshes. I'd like the ability to configure the app / devices to not log info level detail at all if possible. I certainly want errors logged all the time, but the ability to stop any general activity from being logged would be nice.

Thanks,
Simon

The cron format for Hubitat is seconds, minutes, hours,Day of Month, Day of Week, Year

Basically, the way the cron format works, is for any second of the days, evaluate the cron expression to determine if there is a hit.

Each field is a filter. * means it is always a match. 1 means it is only a match if the current data/time is the value 1 for that field. so, if I put a 1 in the seconds, the it will only trigger the the current seconds after the minute mark is exactly 1 second. A hyphen can be use to define a range (5-10 for example) so if field for the current time match 5, 6, 7, 8, 9,or 10 it is a hit. The / notation mean every (more precisely, increments). 0/15 means it will hit on seconds of 0, 15, 30, and 45. 5/15 would mean 5, 20, 35, & 50 are hits.. And that is the problem. I cannot put a number greater than 59 in the seconds field, I have to convert 60 to 1 minute, and put a 1 in the minute field. If I want to update every 70 seconds, I could not do that. there is no filter that I can define that evaluate to true once ever 70 seconds. Hubitat does off runEvery commands, but those are pre-set to intervals of minutes. The best I could is call runIn() which runs a command after a delay in seconds. Then once complete, the schedule if removed. Which means I would have to reschedule the next refresh as soon as the current refresh completes. And this may be what I end up doing.

Regarding logging, I am working that now. I added a log more logging under Debug Logging for the group, and will separate debug logging from informational logging. I implemented this in the app already, so with informational logging you will see log event for changes and notifications, and for debug logging you will get all kinds of data that helps with troubleshooting.

Errors are always logged, unless they are managed/handled errors. That is what I always try to do.

For now, just turn off the logging (which is on by default)

Excellent, thanks. I'm guessing what you may be referring to in the rest of your comment may include the logging that still occurs when assessing if any scenes are active for a group, those messages still get logged even when turning all the settings off that I could find.

This is a great outcome for me, it basically means I can do the lighting dashboard I was wanting, replicating in some respects the hue app. I'll probably post some updated details on the show off your dashboards thread sometime soon and give your app a plug, unless you have any objections....

Simon

This should not happen. Try checking for updated in HPM, and if there are none, try a repair on the hue package. If you turn off the logging in the app turned off for both settings, and the logging turned off in the group, and hub devices, then it should be completely silent except for errors and some warnings

In the App, I have the following:


logging is enabled, but debug logging is turned off.

1 Like

That did it, thanks. I was on the previous version, but have now upgraded and the logging is not appearing on a scene change. Thanks.

Simon

How does this integration differ from CoCo Hue?

I have no Idea. I had not heard of CoCo Hue until last week, and I have no interest in looking at it. I want my solution to be based around my vision of how I believe the integration should work. I have working on this for the better part of a year, on my own. My initial implementation I set out to clone the built-in integration's pairing process. I used the same state variables, and settings names, and did my best to make it look the same. The reason for this was mimic the built-in look and feel, but once I got past the linking process, everything else has been implemented on my own to satisfy my needs, and a friend's needs for the system. As our networks grow, the feature set grew. I can say, from the quick view I had of the CoCo Hue system on GitHub yesterday, they use custom devices drivers for everything, and my goal is to use as few custom devices as possible, relying on Generic Component devices built-into HE. I am completely open to ideas, I have already implemented a couple since initial release the other day.

Hi @armand is there any support for the hue sync box?

I was fixing to try coco then I saw this. Looks nice. Guess I will try out both now.

Thank you for the release.

I don't have one. Not sure how the Sync box would integrate with HE. A friend has one, but he was just looking for me to very basic support similar to scenes..

1 Like

Download the Hubitat app