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

You can make Hubitat do pretty much anything you want, but to make that particular automation easier, have you checked out this app?

2 Likes

This can be done, but on a full second interval using Rule Machine:

Actions
Turn on bulb 1
Turn on bulb 2 (delayed 1 second)
Turn on bulb 3 (delayed 2 seconds)

The color animation app that @bertabcd1234 posted would be able to do that. You could also use Rule Machine too. Hubitat is a very powerful tool that can do most things.

I guess rule machine is as fast and realtime as webcore right? I have been testing to flash bulbs for example 5 times and they do not flash in 1sec intervals by using webcore. Usually the outcome is flash-1sec-flash-2sec-flash-1.5sec-flash-4sec-flash or something like that. So if you are trying to flash bulbs in certain order they would flash randomly and that doesn't look good.

For example if there is a way to strobe lights the way like Hue Essentials do then I would be happy. That would mean that communication is super fast.
In Hue Essentials Android app talks with bridge and it uses wifi to send commands to bridge. That has to be very fast because everything happens in that exact moment. For example when listening music and you get flash when drum kick hits. Second thing is where bridge sends commands to bulbs..and that connection has to be really fast too. That's what I'm missing. Possibility to control light almost real time.

In doing some digging, it looks like Hue Essentials (and other apps that offer similar things) have implemented the Hue Entertainment API, which is a real-time streaming API. To not take away from this thread any more, I'm guessing that you would like to see if @bertabcd1234 is willing to add it to CoCoHue. I'm not sure if it fits the aims of this app and it might actually be better as a unique community app for Hue Bridge owners only, but I'll let Robert answer that.

2 Likes

I'm really not interested in that, in part because I don't have much in the way of "entertainment" things to test it with. :smiley: But it's also a completely separate API and could easily be a different app if anyone wanted to try (and had any ideas for in what ways it might make sense to integrate into Hubitat, beyond the capabilities Hubitat can do on its own with the existing API as described above).

2 Likes

I just started experimenting with the CocoHue integration (over the built in). It looks pretty impressive after about 30 minutes of playing with it... The scene integration is pretty cool...

I also noticed it had the SetEffect option, but it only currently supports 0 (none) and 1 (color rotation)... Is there any plans to add the newer effects like Candle or Fireplace? ( I think Fireplace is Hue Effect 6?)

I have figured out I can create scenes in Hue, and import the Scenes to do it, but, I'd really prefer to control everything through one system, than split across two hubs...

The native integration doesn't support effects at all, so, I appreciate cocohue has supported the original color loop...

Thanks for the consideration!

I'm not sure how those effects work; they may be dynamic scenes, which would require the v2 API for full functionality. I am not using that for scene activation yet but plan to look into it for more features at some point. Incidentally, "color loop" would actually go away with the move to v2, as it's "deprecated" and only available in v1. So, you'd need to do something like manually re-create it as a dynamic scene. The whole "effects" thing would probably go away entirely as a result, though I haven't thought through how I'd do this all yet...

Interesting... Avoiding a LONG history of how I got here, but I had the bulbs connected via Home Assistant and the Home Assistant bridge, and enabling Fireplace mode in HE was just doing a custom command SetEffect 6,

Forgive me as I'm not familiar with the Hue APIs at all... It sounds like dynamic scenes ones that are controlled by the Hue hub... and these particular effects seem exist outside of the Hue Hub

Just for grins I took another Color hue bulb and put it back into HA, and these are the effects that can be enabled in the bulb. These might be API V1 only, but it seems unlikely they are tied to the Hue hub itself, as they can be set on a bulb with no hub.. (although I do think they needed Bulb firmware 1.104.2 before they were enabled)

TBH, every one of them are pretty lame except for color loop, candle, and Fireplace... LOL

A quick glance at the v2 API docs shows some support for effects named prism, opal, glisten, sparkle, fire, candle, and no_effect. This should be possible some day when CoCoHue moves to the v2 API for device control. (Home Assistant is likely combining the Zigbee "identify"/Hue "alert" feature for blink and breathe -- so likely combining different features into the same name in the UI regardless of what they are called in the API -- and possibly still using v1 for "colorloop," but we've been told that will go away at some point.)

The code is, of course, open-source if anyone wants to look before then. :slight_smile:

2 Likes

Hopefully, when it makes the jump to V2, those features will get incorporated...

I can make do with the Scene integration for now. Like I mentioned, I only use the effects around Halloween and MAYBE Christmas, so, it's not huge deal having them split.

(and I already looked at the code, and may decide to break it at some point just for fun, as that would be my first dive into groovy/json/etc..... LOL)

Has anyone come up with a way to smooth din using the button controller and the hue tap dial outer ring?

If so can you post your rule? I’ve been racking my brain and the best I got is a +3 per “button press” that the ring generates

Maybe someone else can find a more creative solution, but I think that might be about the best you can do. To get smooth dimming (e.g., dim while button held until released via the "Start Level Change" and "Stop Level Change" commands), you'd need the device to send something when spinning stops. It doesn't; it just sends repeated events while it's turning, the number (and I think frequency?) of which correspond to the distance and speed. CoCoHue just passes those events on.

There is some discussion above about other ways these might be able to be handled, but all would involve some sort of "faking" via a timer, which I'm not a huge fan of in general but might be workable if everything is reliable enough...

@bertabcd1234
There looks like a typo on the CoCoHue Generic Status Device driver on the word "Refresh":
image

I think maybe the Scene Driver and some of the other drivers may have that same typo too.

1 Like

When the dog sings opera, don’t mention that his pitch is a bit off.

1 Like

I didn't mean anything bad or anything if that's what you mean, just reporting an issue I saw. This integration has been working great, I've used it since it's been released.

2 Likes

I should have put a smiley face, sorry. I didn’t interpret your comment as anything bad, and I am glad that you found this minor spelling error. When something is so amazing as CoCoHue is, it’s unusual to find even such a minor nit as a spelling mistake. I was just being facetious.

3 Likes

Not with the way I type (and no spellcheck the IDE). :rofl: But I appreciate the words!

I've also fixed this typo where I've found it (plus another one nearby) and won't release anything special for it, but it should be fixed in whatever the next release ends up being.

Thanks!

6 Likes

The Hue Hub assigns a virtual hue sensor for your dynamic scenes. If the sensor state is set to 1, it is activated, and if it is set to 0 it is deactivated. If you know your bridge IP address, user ID, and the sensor #, (all can be found using the hue CLIP tool, then you can control your dynamic scenes using the following http Put calls:

To activate a dynamic scene:

http://{hueBridgeIP}/api/{hueUserID}/sensors/{animationSensorNumber}/state/1

To DEactivate a dynamic scene:

http://{hueBridgeIP}/api/{hueUserID}/sensors/{animationSensorNumber}/state/0

Sorry if this is not the best place to ask. I'm new to both HE and just installed cocohue tonight. Is there a recommended app to create automations with coco, or just any of the basic or rule engine as needed? And what is the best method for returning lights to previous state?

What I'm trying to do is get simple, so sorry again. I have an Inovelli switch that when pressed on, I want it to turn on the physical lights, plus activate a Hue scene. When I press it back off, I want the physical lights off, plus hue group revert to prior state. The reason I want revert instead of just setting another scene, is I want the hue lights to go off if they were already off, or back to my default scene if it was already on. Aside from the question about revert to previous state, the rest to me looks straightforward in just the basic rule creation.

They are ultimately just "regular" devices (like anything else on the hub) and can be controlled with whatever apps you want. My suggestion when choosing an app is to pick the simplest one that best suits your automation goals. In many cases, that could be Basic Rule or some purpose-built app.

However, for the "capture and restore" part of your automation, Rule Machine might be the best way to go. Unfortunately, this may not be easy if you are new to the platform. As one way to start, if you already have a Basic Rule that does what yo want, you can "import" that into Rule Machine and modify it from there. The "Capture" and "Restore" actions in RM might be what you want, or in your case it sounds like you could really just store the initial state (on or off) in a local Boolean variable, then test that variable later and either turn the lights off (if they were off) or activate a scene (if they were on).

If you have questions about Rule Machine, I might suggest posting a question in the Rule Machine category. Good luck!