[RELEASE] CoCoHue: Hue Bridge Integration (including scenes!)

I think this works already. You'll get pushed and held, not just one or the other, but that's how they get sent over the API, and the only way around that seems to be an in-driver timer, which I'm not a huge fan of in general.

Hmmm... interesting.... I'll test it out over the weekend. Thanks @bertabcd1234 .

@bertabcd1234 , are you seeing any odd behavior within the past week or two? I’m seeing more problems with missed events and wondering if it’s related to the last Hue update, or the HE updates. Not a huge deal since I’ve only been using the push events in 2 rules, but thought I’d ask.

Do you see any errors in Logs? There were some changes in platform the public release of 2.3.3 (nothing in CoCoHue recently) and more in a recent beta that might affect some drivers, though I hope not mine. :smiley:

No new ones. I still see these on both Hue bridges:

Yeah, that shouldn't be causing this (though is still something related to either the eventstream interface on the hub or how Hue is sending this data, as far as I can tell). I'll keep an eye out on mine, though!

1 Like

Issue related to my edge case:

I have a Button Controller multi-tap scene using an Innoveli switch set to randomize colours for a room with RGBW hue bulbs.

Using the hiRes/colours in degrees setting enabled and using the Set Bulbs -> Random colour setting in rule machine results in most colours restricted to red and green hues.

Having it on the default setting results in full range of hues. I think this might be an issue with Rule Machine passing RGB values (0-100) to the HSV parameter (0-359).

1 Like

This is an issue with any driver that offers this option, and I would leave it disabled unless you have a specific use case that requires it (most people can't tell the difference between the 3-4 degrees of difference anyway). Hubitat's standard is 0-100, and apps do not have a way to know if this setting is in for a particular device. Some may let you input values up to 360, and if RM does when the Set Color action is used manually (I know it at least used to), you can work around that by using a variable instead and setting the variable to a random value, among other options.

2 Likes

Hi all

I have had eventstream set up for a while across five bridges and it was working perfectly.

Recently it has stopped and there is now a delay before things are updated. Seems to wait until the bridge is polled before updating.

The only changes I have made are to update the two hubs I have - nothing else.

Is this the same for anyone else?

Cannot work out what the issue may be.

Grateful for any thoughts!

Thank you

I haven't seen this, but there's no need to guess. Enable debug logging on the Bridge driver, and you'll either see EventStream entries come in as things happen or not--or even just check logs (or probably Past Logs at this point) for errors or other problems, which there very well could be if this option is enabled but isn't working for you.

An example of a log entry from the Bridge device that indicates eventstrem data:

parse: data: [{"creationtime":"2022-10-28T16:23:04Z","data":[{ ...

1 Like

Thanks - I had been looking at the logs but it is a bit of a mystery.

Below are the logs of turning a bulb on and then off (after the status has updated).

This is what the relevant bridge app says:

app:962022-10-28 19:30:24.425debugupdateSceneStateToOffForGroup matching scenes: []
app:962022-10-28 19:30:24.420debugSearching for scene devices matching group 2 and excluding DNI null
app:962022-10-28 19:30:24.234debug Setting Bridge status to Online...
app:962022-10-28 19:30:24.030debugRunning getBridgeData()...
app:962022-10-28 19:30:24.019debugrefreshBridge(reschedule = null)
app:962022-10-28 19:29:56.146debugUpdating member bulb states after group device change... (ids = [41, 42, 43, 44, 45, 46], isAllGroup = false)
app:962022-10-28 19:29:56.139debuggetEventStreamOpenStatus (returning true)
app:962022-10-28 19:29:56.133debug Setting Bridge status to Online...
app:962022-10-28 19:29:56.114debuggetEventStreamOpenStatus (returning true)
app:962022-10-28 19:29:56.107debug Setting Bridge status to Online...
app:962022-10-28 19:29:56.083debugRunning getBridgeData()...
app:962022-10-28 19:29:56.060debugRunning getBridgeData()...
app:962022-10-28 19:29:26.890debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:29:26.845debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:29:26.714debugUpdating member bulb states after group device change... (ids = [41, 42, 43, 44, 45, 46], isAllGroup = false)
app:962022-10-28 19:29:26.707debuggetEventStreamOpenStatus (returning true)
app:962022-10-28 19:29:26.701debug Setting Bridge status to Online...
app:962022-10-28 19:29:26.673debuggetEventStreamOpenStatus (returning true)
app:962022-10-28 19:29:26.667debug Setting Bridge status to Online...
app:962022-10-28 19:29:26.579debugRunning getBridgeData()...
app:962022-10-28 19:29:26.556debugRunning getBridgeData()...
app:962022-10-28 19:29:25.878debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:29:25.852debuggetEventStreamOpenStatus (returning true)
app:962022-10-28 19:29:25.848debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:29:25.839debug Setting Bridge status to Online...
app:962022-10-28 19:29:25.712debugRunning getBridgeData()...
app:962022-10-28 19:29:24.247debug Setting Bridge status to Online...
app:962022-10-28 19:29:24.031debugRunning getBridgeData()...
app:962022-10-28 19:29:24.020debugrefreshBridge(reschedule = null)
app:962022-10-28 19:28:53.084debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:28:52.928debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:28:47.913debugRunning getBridgeData()...
app:962022-10-28 19:28:41.870debugsetEventStreamOpenStatus(false)
app:962022-10-28 19:28:33.772debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:28:33.753debuggetEventStreamOpenStatus (returning true)
app:962022-10-28 19:28:33.749debugsetEventStreamOpenStatus(true)
app:962022-10-28 19:28:33.746debug Setting Bridge status to Online...
app:962022-10-28 19:28:33.631debugRunning getBridgeData()...
app:962022-10-28 19:28:24.237debug Setting Bridge status to Online...
app:962022-10-28 19:28:24.030debugRunning getBridgeData()...
app:962022-10-28 19:28:24.020debugrefreshBridge(reschedule = null)

This is the corresponding device:

> dev:1032022-10-28 19:30:24.667debugParsing Labs sensor states...
> dev:1032022-10-28 19:30:24.662debugParsing sensor states from Bridge...
> dev:1032022-10-28 19:30:24.367debugParsing group states from Bridge...
> dev:1032022-10-28 19:30:24.237debugParsing light states from Bridge...
> dev:1032022-10-28 19:30:24.225debugChecking if valid HTTP response/data from Bridge...
> dev:1032022-10-28 19:30:24.221debugparseStates: States from Bridge received. Now parsing...
> dev:1032022-10-28 19:30:24.025debugrefresh()
> dev:1032022-10-28 19:29:26.885debugparse: data: [{"creationtime":"2022-10-28T18:29:23Z","data":[{"id":"52926233-b690-482b-a014-69dc0c5ae2b2","id_v1":"/lights/41","on":{"on":true},"owner":{"rid":"dd22a175-43b0-4907-b12d-75270b6d88a5","rtype":"device"},"type":"light"},{"id":"be28e77c-08cf-47ae-8e61-e638c69896c3","id_v1":"/lights/42","on":{"on":true},"owner":{"rid":"47688a43-b787-4ce6-a480-c768ca14a29d","rtype":"device"},"type":"light"},{"id":"4aa9c8ba-a29f-43ea-8840-e6ba6cb0b7da","id_v1":"/lights/43","on":{"on":true},"owner":{"rid":"0b214dc4-f44b-4725-9087-48c80e005142","rtype":"device"},"type":"light"},{"id":"5c48700c-57e6-43ec-87d5-1f157c2a330b","id_v1":"/lights/44","on":{"on":true},"owner":{"rid":"ce1a9a54-50d6-49e9-9ddd-4969ed99044b","rtype":"device"},"type":"light"},{"id":"8e205658-14c8-44a2-af5d-16d456dbbc4e","id_v1":"/lights/45","on":{"on":true},"owner":{"rid":"59b6b238-bef4-4eb7-8f82-3cf0be7e3b91","rtype":"device"},"type":"light"},{"id":"c16354e8-431b-4fa5-9fae-deee4139d873","id_v1":"/lights/46","on":{"on":true},"owner":{"rid":"acc7e43b-7ada-4305-b59e-5cf40770d0a2","rtype":"device"},"type":"light"},{"id":"3dc7630a-97e2-46f6-9fe0-00beaeafb940","id_v1":"/groups/6","on":{"on":true},"owner":{"rid":"ea14cf2e-5e47-41c7-b165-d88a71508179","rtype":"room"},"type":"grouped_light"},{"dimming":{"brightness":100.0},"id":"3dc7630a-97e2-46f6-9fe0-00beaeafb940","id_v1":"/groups/6","owner":{"rid":"ea14cf2e-5e47-41c7-b165-d88a71508179","rtype":"room"},"type":"grouped_light"}],"id":"b9b9dda0-e158-4250-b205-eaab77473391","type":"update"}]
> dev:1032022-10-28 19:29:26.869traceno data parsed from message: id: 1666981763:0
> dev:1032022-10-28 19:29:26.866debugignoring line: id: 1666981763:0
> dev:1032022-10-28 19:29:26.840debugparse: id: 1666981763:0
> dev:1032022-10-28 19:29:25.931debugeventStreamStatus: STOP: EventStream Stopped
> dev:1032022-10-28 19:29:25.873debugparse: data: [{"creationtime":"2022-10-28T18:29:22Z","data":[{"id":"5e93ea75-bfbc-4e40-bb6b-84268a3bb218","id_v1":"/lights/38","on":{"on":false},"owner":{"rid":"ee0c6335-2106-4af3-900d-29927375d24f","rtype":"device"},"type":"light"},{"id":"ef6ba565-0d39-4c59-99fd-c837bbb6e5be","id_v1":"/lights/39","on":{"on":false},"owner":{"rid":"df9c7e61-c01c-4f2f-99d5-0ebd6fb61367","rtype":"device"},"type":"light"},{"id":"3a8a3ee4-c3a7-43b3-8822-3705308a7e9b","id_v1":"/lights/40","on":{"on":false},"owner":{"rid":"29242574-8ee8-4ede-9094-94f1bdf93c51","rtype":"device"},"type":"light"},{"id":"9d8a28b0-49d6-4f68-918b-3e457d46d465","id_v1":"/groups/2","on":{"on":false},"owner":{"rid":"82d45c6c-07c7-44c0-87ec-828efdf505c9","rtype":"room"},"type":"grouped_light"},{"dimming":{"brightness":0.0},"id":"9d8a28b0-49d6-4f68-918b-3e457d46d465","id_v1":"/groups/2","owner":{"rid":"82d45c6c-07c7-44c0-87ec-828efdf505c9","rtype":"room"},"type":"grouped_light"}],"id":"92bef127-ad55-49e7-8cb8-9a85398eb7b2","type":"update"}]
> dev:1032022-10-28 19:29:25.862traceno data parsed from message: id: 1666981762:0
> dev:1032022-10-28 19:29:25.858debugignoring line: id: 1666981762:0
> dev:1032022-10-28 19:29:25.834debugparse: id: 1666981762:0
> dev:1032022-10-28 19:29:24.656debugParsing Labs sensor states...
> dev:1032022-10-28 19:29:24.653debugParsing sensor states from Bridge...
> dev:1032022-10-28 19:29:24.379debugParsing group states from Bridge...
> dev:1032022-10-28 19:29:24.250debugParsing light states from Bridge...
> dev:1032022-10-28 19:29:24.238debugChecking if valid HTTP response/data from Bridge...
> dev:1032022-10-28 19:29:24.234debugparseStates: States from Bridge received. Now parsing...
> dev:1032022-10-28 19:29:24.026debugrefresh()
> dev:1032022-10-28 19:28:53.097traceno data parsed from message: : hi
> dev:1032022-10-28 19:28:53.094debugignoring line: : hi
> dev:1032022-10-28 19:28:53.079debugparse: : hi
> dev:1032022-10-28 19:28:52.941infoCoCoHue Bridge 2176D3 (HFHBoxE (first)) eventStreamStatus is connected
> dev:1032022-10-28 19:28:52.923debugeventStreamStatus: START: EventStream Started
> dev:1032022-10-28 19:28:47.916debugConnecting to event stream at 'https://192.168.0.252/eventstream/clip/v2' with key '9BzdtZ4xj-lEiHnd9W9tGlwJpPUuWuGxwMzBe8wE'
> dev:1032022-10-28 19:28:47.905debugconnectEventStream()
> dev:1032022-10-28 19:28:47.900debugreconnectEventStream(notIfAlreadyConnected=true)
> dev:1032022-10-28 19:28:41.880debugreconnecting SSE in 6
> dev:1032022-10-28 19:28:41.876infoCoCoHue Bridge 2176D3 (HFHBoxE (first)) eventStreamStatus is disconnected
> dev:1032022-10-28 19:28:33.844debugeventStreamStatus: STOP: EventStream Stopped
> dev:1032022-10-28 19:28:33.840debugeventStreamStatus: STOP: EventStream Stopped
> dev:1032022-10-28 19:28:33.768debugparse: data: [{"creationtime":"2022-10-28T18:28:30Z","data":[{"id":"5e93ea75-bfbc-4e40-bb6b-84268a3bb218","id_v1":"/lights/38","on":{"on":true},"owner":{"rid":"ee0c6335-2106-4af3-900d-29927375d24f","rtype":"device"},"type":"light"},{"id":"ef6ba565-0d39-4c59-99fd-c837bbb6e5be","id_v1":"/lights/39","on":{"on":true},"owner":{"rid":"df9c7e61-c01c-4f2f-99d5-0ebd6fb61367","rtype":"device"},"type":"light"},{"id":"3a8a3ee4-c3a7-43b3-8822-3705308a7e9b","id_v1":"/lights/40","on":{"on":true},"owner":{"rid":"29242574-8ee8-4ede-9094-94f1bdf93c51","rtype":"device"},"type":"light"},{"id":"9d8a28b0-49d6-4f68-918b-3e457d46d465","id_v1":"/groups/2","on":{"on":true},"owner":{"rid":"82d45c6c-07c7-44c0-87ec-828efdf505c9","rtype":"room"},"type":"grouped_light"},{"dimming":{"brightness":100.0},"id":"9d8a28b0-49d6-4f68-918b-3e457d46d465","id_v1":"/groups/2","owner":{"rid":"82d45c6c-07c7-44c0-87ec-828efdf505c9","rtype":"room"},"type":"grouped_light"}],"id":"3e4bde02-c137-4d1a-9551-f97b20f3ce7c","type":"update"}]
> dev:1032022-10-28 19:28:33.760traceno data parsed from message: id: 1666981710:0
> dev:1032022-10-28 19:28:33.756debugignoring line: id: 1666981710:0
> dev:1032022-10-28 19:28:33.742debugparse: id: 1666981710:0
> dev:1032022-10-28 19:28:24.607debugParsing Labs sensor states...
> dev:1032022-10-28 19:28:24.603debugParsing sensor states from Bridge...
> dev:1032022-10-28 19:28:24.369debugParsing group states from Bridge...
> dev:1032022-10-28 19:28:24.241debugParsing light states from Bridge...
> dev:1032022-10-28 19:28:24.228debugChecking if valid HTTP response/data from Bridge...
> dev:1032022-10-28 19:28:24.224debugparseStates: States from Bridge received. Now parsing...
> dev:1032022-10-28 19:28:24.025debugrefresh()

If you have any ideas what is going wrong on my end, please do shout.

As I said, everything used to work and update immediately - now there is a significant lag and I cannot fathom why.

Thanks

I'm not sure; looks like eventstream is enabled, and these debug logs for the bridge device (the app isn't important here) are indicative of that:

parse: data: [{"creationtime"

as only JSON that looks like that ("creationtime" is one giveaway) is from the v2 API.

Are you noticing this with all attributes, like switch (on/off), or only certain ones (like color)? Asking because it's possible certain color values will only come in on a refresh due to the v2 API making heavier use of the XY color model that is difficult to convert to Hubitat's HSL model (but the v1 API may still have this information in some circumstances).

Good question - I have just been testing on and off.

But testing some colour bulbs - the colour of those on the dashboard updates immediately whereas the on / off function does not.

My dashboards generally have all the bulbs set as "bulbs" even if they are colour ones, but the on / off function is generally an hour glass for 30 seconds or more.

1 Like

Dashboard, eh? :slight_smile: It should reflect the device states accurately, but I'd leave Dashboard out of the picture and look directly at the device detail page from the regular Hubitat UI. You should see "Current States" towards the top or upper right, and whether things update there in a timely manner is the real question to separate this from a Dashboard-only issue.

1 Like

It is not just the dashboard - the actual devices take time to update as well.

1 Like

I'm not sure, then. There are occasional disconnects from the eventstream, or at least the interface often claims to disconnect (though in a lot of cases it's fine). If that happens, the driver will revert to polling only (and by default will combine both, though you can disable or enable either). If this is an occasional problem, I'd guess that maybe you're just particularly unlucky and happen to see this when the eventstream is disconnected. If it's all of the time or only for specific devices, I'm not sure but might be able to figure out more with more logs that I can help you pinpoint. I'm hoping the eventstream improves with possible changes to Hubitat's library or a better way to parse the data if it's something the driver is doing, though I'm not aware of anything.

Thanks for having a ponder. Unfortunately it is all the time.

I might uninstall and reinstall and see if that does anything…

I’m seeing the same thing, so I doubt that will make a difference. Sometimes the reporting is immediate, other times the state doesn’t change until it is polled. I don’t rely on the push events for anything except for one rule. When that rule consistently works I’ll try using push events for more things.

Thanks. It’s very curious - a few months ago everything was instant every time.

I don’t know if it’s the Hue firmware updates or the Hubitat firmware updates, but it does seem like it’s less reliable than it used to be.