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

Introducing...

CoCoHue:
The Community Collection of Hue Bridge Integration Apps and Drivers

Installation instructions can be found in the GitHub repo:

I've tried to make this integration as Hubitat-like as possible, working nearly identically to the native integration except when extra features are used and using standard capabilities whenever possible for new features. This is part of the reason I started over with writing an integration from scratch instead of modifying an existing integration like Hue B Smart or porting a different app/driver like Hue Advanced. To my knowledge, this integration currently implements everything Hubitat does (except Bridge discovery), plus these often-requested features:

  1. Access to Hue bulb "effects" (color loop, select/alert, etc.)
  2. Improved group support ("Change Level" capability-- startLevelChange and stopLevelChange commands implemented)
  3. Scene support! (Creates button/switch device for each; switch responds to on only.)
  4. It's open source! Customize the code to suit your requirements if you so desire.
  5. Note: all bulbs are currently implemented with the RGBW bulb driver; this will change, but since this is the most feature-rich driver and the rest will basically be pared-down versions of that, it was easier for me to start this way (harmless, but keep in mind that obviously features like setColor won't work on a Hue White bulb)

Documentation on the extra features can be found in the Readme on Github. My plan is to keep stable releases in the Hubitat Community repo at GitHub - HubitatCommunity/CoCoHue and keep more experimental code in my own, GitHub - RMoRobert/CoCoHue: CoCoHue: Hue Bridge Integration for Hubitat. Feel free to use whichever you like, but if you have any problems or questions, let me know which one you're using.

Let me know if you notice any problems! This is my first public release of this code, so I'd proceed with caution, but I've been using it for my own lights in place of Hubitat's own integration with no problems so far.

More to come, including:

  • dedicated drivers for Hue Ambiance (CT), non-Plus Hue Lightstrip (RGB), and Hue White (Dimmable Bulb) drivers
  • Bridge discovery if I can ever figure out why SSDP doesn't seem to be working...
  • bug fixes? I am really curious what people who aren't me find :slight_smile:
12 Likes

Excellent, I was really missing this on the stock Hubitat integration! Helps speed up dimming with picos

1 Like

Greetings, all. I've released CoCoHue 1.5 with updates to all drivers plus a new driver for scenes and introduced (surprise) scene support! Scenes are named as "Room Name - Scene Name" (works well for Bridge scenes that are created per room/zone and otherwise have the same name) and are exposed as both Pushable Button and Switch devices, so either a push(1) (or really any push() command--the button number is ignored) or an on() command will activate the scene. An off() command does nothing since Hue doesn't support turning off scenes (closest I could do is turn off a group for a GroupScene if anyone would find that useful).

Let me know if you run into any problems! I've switched all my Hue bulb/group integrations over to this and added several scenes, and it's working well for me.

EDIT: Minor update v1.5b for group, RGBW bulb, and scene drivers with minor fixes (one of which is that the scene driver had the wrong importUrl, so please copy that one from Github again or grab the correct raw URL before you try that one).

EDIT 2: Another minor update to v1.5 for some drivers to fix duplicate colorName events from RGBW bulbs and group devices from getting logged (logs only; no new events were actually generated from this artifact of parsing bridge info).

EDIT 3: I've updated the scene driver again because I still had importUrl wrong. Updating manually from GitHub or the raw URL will work (I had the wrong capitalization, so the "Import" button won't do anything at all here, so you'll notice if you try to do it that way--but this should work going forward).

1 Like

Can I use ur integration for some bulbs and the native one for others?

You can do anything you want. :slight_smile: But I'm not sure why you'd want to unless you gradually plan to transition everything to one or the other (I did when I was testing this)--two apps polling your Hue Bridge isn't bad, but one is better.

Yea. Just asking for the transition. Don't have time to do it all.

So does this work for groups as well as zones? Zones is a so called beta feature in hue app but I use it alot. Thx

Yes, zones should show up as groups (which I'm pretty sure they also should for Hubitat's native integration, but I never tested that). They're pretty much identical to groups in the Hue API.

@bertabcd1234

Just started playing with this integration. I was previously using the Hue-B-Smart port. Besides specific drivers for CT bulbs and White Bulbs which I understand your working on, I was wondering if you could implement a "flash" command with the ability to adjust the duration/number of flashes? It's one feature that I like in Hue-B-Smart since it allows a compromise between a single flash and the full length sequence. In Hue-B-Smart this was called "flash-Notify".

Edit: I do realize that I can achieve something similar by executing multiple "flashOnce" commands with short delays in between, but the method Hue-B-Smart used is more user friendly and bit more consistent.

@bertabcd1234, I ended up putting my Hue bulbs back on the Hue bridge (the functionality on HE is not great) and I’m using your integration. I love it so far and the group dimming is awesome, but I’m having trouble getting scenes to activate with RM and ML. I use per mode settings and created HE scenes to turn on the scene device and also to push the scene button, but it still doesn’t activate the scene. Any idea how I can get this working?

The Hue Bridge provides only two options ("alerts") via the API: the "select" command that flashes once, and the "lselect" command that does 15 flashes. I looked at the Hue B Smart bulb code, and it appears their "flash notify" command just starts the "lselect" and then sends a command to stop it after a certain number of seconds. Their default is 5, but what it doesn't look like it tells you is that it will stop after 15 regardless of what you choose.

This is something you can already do with the group or bulb driver in CoCoHue: sending an on() or off() command cancels any alert or effect, and choosing one alert will cancel another (so a select/flashOnce() will cancel an in-progress lselect/flash() after doing just one more flash). Since it's a custom command and you'd need RM or a custom app to make this work anyway, my suggestion would just be to send an on() or off() command (if you want a specific end state) or a regular "select" (flashOnce() command) when you want the flash/notification to stop. In a rule, this would be something like:

Run custom command: flash() on Hue Bulb 1
Delay 0:00:05
Run custom command: flashOnce() on Hue Bulb 1 (or: On or Off)

My look at a few other Hubitat bulb drivers suggests that this is about how you'd have to do it there, too, minus the fact that flashOnce() seems unique to Hue bulbs. That being said, I'm still open to ideas if people would really find a dedicated command useful here, particularly if there are any conventions here beyond what Hue B Smart chose. There are just some limitations to what can be done (endless flash not possible, and the timeout is faked by the driver, not done on the Hue side).

And I do indeed plan to provide dedicated drivers for bulbs with fewer capabilities than the RGBW ones. Just wanted to see how these work for people first so I don't have to change code in multiple places if things like the above are something people want (or there are any big problems). :slight_smile:

I hear you: I tried a Hubitat hub dedicated to Hue bulbs, but eventually gave up and went back to the Bridge. No more worries about addressing too many bulbs at once or with bulbs missing color or level commands after an on()...

Anyway, for the scene device, I'm certainly interested in fixing this problem. Do I understand correctly that you created a Hubitat scene that simply activates the CoCoHue scene device? If so, I'd first try eliminating Hubitat Groups and Scenes from the picture first. Does the CoCoHue scene device itself work if you activate it directly? (As you know, either an on() or a push(1)--or really, any push command since I just make it ignore the number--should work.) If not, there's a CoCoHue problem I can look into (I can tell you what logs would be helpful for me to track that down).

If the problem only exists via Groups and Scenes, I'm less sure but can say on/off optimization would probably need to be turned off if that's an option anywhere (Hue scenes can't be turned off, though you can turn off the CoCoHue scene device itself with no effect; what I'm getting at is that the scene will respond to repeated on() commands, but it's possible Hubitat won't send that the scene device, a Switch-capability device, reports as already being on). I can't see why a push would have this problem.

Thanks! Sending the "flashOnce" command after a delay did the trick. Sending an ON/OFF wouldn't be desirable as it would override the current state of the light.

So far the RGBW driver seems to be working well with all of my bulbs, including the CT and White Only, but having a less "featured" driver will likely make things a little less confusing when setting up rules.

Thanks again!

1 Like

Yes

Yes

Me neither. I tried the switch on and then added the push as well. I’ll see if I can figure out something else later today.

Interesting. I'll try setting up a Hubitat scene myself when I'm at home to see if I can replicate the problem. Turning on logging for the scene device may help you figure out whether the on or push commands actually get called. You won't see anything for push() (so I'll probably add a debug log there when I test); an on should log "Turning on scene...".

I figured it out. I had set up the scenes, but not captured them. I didn’t realize the mistake until I looked at it again today. Sooo, never mind. Everything works great!

1 Like

@bertabcd1234 I was going to test this in a rather limited way so as not cause issues with WAF. However it appears to be working so well I went ahead and converted all of my rules and have removed the stock integration completely.

All I can say is "WOW" performance seems to be as good or better than the stock integration and the addition of the scenes and flash commands are a hugely welcome addition that I've been waiting for since I got my C-4 last year.

Congrats on your hard work, it sure seems to have paid off!