[FEEDBACK] CoCoHue 5.1 update

I agree the community is great with adding support for new devices and apps!

Hubitat itself does well at consistently evolving its apps and making new ones. It does well adding new device compatibility. However, it does not do well with continuous improvement of released device drivers. One of Hubitat's comparative strengths are its apps that make using device capabilities pretty powerful and "easy" to implement. When devices get implemented at the minimum level those "advanced" device capabilities get hidden from lots of users.

Companies like Apple and Microsoft continually adopt ideas that were originally 3rd party into the base systems. That ends up being good for them and their users.

I look forward to 2.4!

1 Like

I think that's a good choice. It matches semantically how people use these scenes - "Turn on movie scene". And then "turn off the lights". For people who want more scene state information Room Lighting is a good choice. The "Advanced Uses of Indicator section" is useful for scenes that are activated by button pushes.

5 Likes

I appreciate the momentary switch being added. I was holding off on updating since 5.04 due to needing to figure out how to implement the change in a couple of very old ML rules. This will make it possible to continue using ML since the scene buttons did not appear available in ML (push button per mode). I personally wouldnā€™t have asked you to add this, but it makes things easier, so thank you.

3 Likes

I'm going to offer this last note about CoCoHue 5.x and it is written to the person who wrote it. I'm not exactly sure who that is, but that is the "you" I am referring to. Everyone else will benefit from reading this as well.


Iā€™m pleased to hear youā€™ve reconsidered some of your changes to CoCoHue 5.0. In a perfect settings, I would ask you to go further and rollback all of your 5.x changes for the reason that I donā€™t think you have a sufficient understanding of your users, might be trying to do too much and are compromise your past work, and this community forum has qualities of "echo chamber" so you might not be getting the best feedback.

Though there are plenty of people on these forums that you might consider "users," they aren't ALL of your users. Most of your users, like me, won't communicate with you at all -- assume the quiet ones are happy users. I consider myself a happy CoCoHue user one most of the time. I'd bet that I interact with CoCoHue dozens of times a day.

Am I grateful for this? Sure. But I'm a "user," not your mother. I'm not going to kiss your holy ring because you built something for free, we're not friends, and I suspect the limited relationship we have between "maker" and "user" may be the happiest one we will ever have ;-).

Danny -- the TV installer I mentioned in a previous post -- is also a happy user. He's so happy, he put Hubitat, Hue, CoCoHue, a MiniPC running MicroK8S, and ngrok into his clients' homes. He took advantage of the massive growth in housing construction around Walt Disney World and was able to leave his job working as an A/V tech for a major resort chain and support his family with his own business installing TVs and home automation. He administers these environments remotely and has achieved the ability to scale the deployments across houses of similar design. He's been quite clever and his success is a story for another time

Danny's approach changes the way I look at Hubitat as a piece of bigger picture. If you were to put this setup into 20 homes and install 20 Hue light fixtures per home, you'd run into the unfortunate fact that as you added each light to its Hue hub, it would get a different ID in the Hue API. Which means if you want to standardize across homes and have a command that turns on lights in different configurations in different rooms, you'd set up scenes and groups in Hue and reference them by name.

The Living Room group, for instance, could have any number of lights in it, all with different assigned Hue IDs, but as long as you named the Living Group something standard -- "LVR_GRP" -- you could easily discover the group in the API, find its ID, and call its Hue endpoint to turn on all the lights in the group. Same goes for Hue Scenes, and I understand you can also invoke actions on these scenes. CoCoHue made this obvious and easy to do for a time.

You'd also teach users to communicate with devices using a series of commands that start with "Alexa, turn on XXXXXX" where XXXXXX is not necessarily a light or a series of lights but a lighting "experience." You'd have "Alexa turn off the living room" which would such shut off all lights in a living group regardless of their actual state. You'd have an "Alexa turn off the house" to shut off every light and "Alexa turn on the house" to return all of the lights to the state they were in when you left the house. Of course you can do all sorts of other things as Maker, but as a User who has limited time and attention for the minutiae, Danny thinks this is enough. Does Hubitat do this? Does Hue this? Do CoCoHue do this? Sort of yes, but nothing does it all in a repeatable way that can be deployed at scale and remain reliable over time.

It gets better. You can give the Hue app to the homeowner and let them tweak the lights all they want. Users can handle tweaking, but they can't grok how to make intelligent groups, name them well, add lots of lights to a group, or handle cases where 10 lights on multiple platforms all need to change from a command and autocorrect if some transient failure stops all the jobs on a particular platform from running. So long as the users don't blow up the groups or the scenes, the mapping of lights to group/scene remain the same. Danny also did something clever with Hue to reset a customer's hubs to its default when he installed it.

Life is great if every device were in Hue. But they aren't. This is where Hubitat comes in. You could, for instance, add Matter devices into these groups and call them along with the Hue lights. And with the Maker API, you wind up standard API interface to Hue, Matter, Zwave, and Zigbee devices. This makes Hubitat a kind of "proxy" to hardware devices.

As an aside, going further you can pull this map of APIs and express them as custom resources in Kubernetes and write services against them which Danny did (with help) and deploy that cluster on a mini PC running MicroK8S. For instance, my LVR_GRP gets activated with a turn_on event at 5 AM using the kubernetes job scheduler which is a bit more robust than the job schedulers in Hubitat or the Hue alone with configuration that can be manipulated using standard DevOps-y tooling. The K8S custom resource in the fronts a pod that can written in any language to make API calls to one or more Maker API services and provide a discoverable log stream or metrics endpoint that can be pulled remotely. This is powerful but it does shrink Hubitat's role in managing a smart home, which is a good thing because the Hubitat capability is limited. It is no trivial feat to write driver code for it in Groovy script (I think??). It is hard to test and deploy at scale. (If Hubitat didn't have a reliable means to backup and restore the state from files, the device would be useless, but also a topic for another time.)

I share this with you so that you can understand that CoCoHue is part of a bigger picture. One of its BEST qualities is that it treats Hue Scenes and Groups as SWITCHES.

Some time ago, smartPeople (not me) started treating the Hubitat Package Manager (HPM) as a potential attack vector for malicious code. Baring an alternative, they forked the HPM repo that had these package sources, kept it private, did some fancy security things with code signing and proxies, and used whitelisting to only include packages from sources they trusted. The CoCoHue source was one. Those smartPeople also started scraping GitHub API to see changes to release tags so that they can be aware that something has changed and update their whitelist. For CoCoHue, that would be this page

https://github.com/HubitatCommunity/CoCoHue/releases/

Now what they didn't see here is a release for 5.x.

The error in their judgement, and mine, is that we trusted the 5.x was a continuation of the general design of 4.x and that turned out to not be the case. They also trusted that they could pull code from the Hubitat Package Manager that pointed to this repo without risk.

12 Hubitat installations died in the process and had to be restored from backups.

Now one could easily point to the release notes and say -- "you didn't read them." I did read them. I didn't make the connection that the consequence of adopting the CoCoHue is that that nearly integration touching a scene would need to change and that I would break the interactions I have with Alexa to turn on and off scenes.

I remember reading something somewhere that suggested letting Alexa handle the communication between itself and Hue is better. I suppose that it might be in some cases, but not in my case or in Danny's. Learning new voice commands already well-practiced is a consider change of behavior and burden on the brain.

There was one enterprising person homeowner who decided to roll with the changes in 5.x and adjust his code to accept that Hubitat scenes would now be push button events. He was able to get this to work, having much more patience than me, but got burned when some other function fired several hundred thousand events to that Maker API endpoint in front of the push button. Since it was no longer a switch, he was not able to use the fail safe intrinsic in switches which is that if you to fire 100K "ON" events to a switch that was already on, the subsequent events are ignored. One of the most useful things about switches that only POWER ON is that the automated POWER OFF event (which is ignored by a Hue scene entirely) can be delayed so the switch state machine absorbs erroneous calls and does nothing for time and eventually triggered to reset itself to POWER OFF state that will accept new commands -- a kind of circuit breaker pattern. As the state machine was lost by making these things buttons that you can trigger with GET HTTP commands, those events managed to fire and hit the Hue box which triggered the scene many times (don't know if all 100K made it, but a bunch did) and burned out the bulbs and the light fixture socket. It also flooded his network with traffic making every other Zigbee device inoperable. The change from switch to button also makes the Maker API more vulnerable -- you have add rate limiting to the HTTP GET commands as you now longer have the circuit breaker.

So, can Hubitat more than just "inconvenience" a homeowner if something goes wrong? In this case, yes. You can call it a strange edge case only a nutter would create for himself if you wish, but I'm telling you the story as it happened, and there could have been 12 such nutters had the first one not been very noisy about his plight. Picture the sight of outdoor Jack Skellington Halloween inflatables (this is Disney World backyard) on people's lawns controlled with Hue lights burning out, setting fires to the background music "This is Halloween, every laugh and scream" airing on CNN. The lesson here is that any script loaded into a Hubitat box is a potential attack vector for malicious code and should be treated with the same due diligence -- release communication, package tagging, signing, software supply chain defenses -- a developer would treat any other code on the Hubitat box itself.

Now, are you the maker responsible for any of this? Hell no. Danny is responsible for this clients, takes actions to protect his users, implements controls, insures his business, etc. CoCoHue is not the only open-source app he deals with. I would not have mentioned him at all had I not thought that you might take pride in knowing your code is being used by people -- both high praise and all the thanks you should need. So, please give him some credit -- he doesn't have a poor support model. What is he has is a flaw in his ability to detect changes to CoCoHue using the standard, automated means he thought he could rely on -- which in this case is a 5.x release tag on Github.

Next time, can you make sure he has that? It's up to you, of course. I'm asking for a friend.

A reasonable person would look at this statement and ask "Why?" and suspect this isn't really an upgrade. I'm not always a reasonable person.

Thankfully, in the cases I have seen, the individuals all had reliable hub backups. They will stay at 4.x and will be using clones of CoCoHue for now. I'm not suggesting you are responsible for what they do, but as the 5.x branch breaks the API contracts you set previously in a way that would require many changes to the other things CoCoHue depends on, perhaps, they would be foolish to stay on your release train. A security-conscious person might think that anything that gets deployed on a Hubitat box that causes a user to have to restore a backup is MALWARE even if the maker's intentions are pure.

II don't see any pull requests or commentary on the 5.x changes in Github. I understand you maintain this work in your spare time. Itā€™s a labor of love perhaps. But CoCoHue is an important piece of code to some people that has the potential to cause physical damage (as we have observed). You should not bear the burden of making sure your stuff works alone. Even if your release notes are the clearest of possible communication known to humans, it would not have replaced seeing the actual change in black and white more easily. Pull requests and their discussion give folks like me a means to help you and call you off the ledge if necessary. Tracking a pull request makes it harder to lose the thread between idea, intent, and resulting action.

There are folks here that will tell me after reading this note that I'm being harsh and attacking a person who is benevolently giving their time to others. They are entitled to do this. They may also be the sort who vote for candidates in elections on the basis of "vibes." I cannot control what they think or do.

If you feel that you've been attacked, you can fault my inability to communicate effectively. I don't know you, and have no reason to wish you ill. But I also don't want to get phone calls from people who say, "You told me to use this CoCoHue on my hub and I blew up my lamp post and summoned Satan from my garage sink." I hope you can make some changes to improve your release hygiene and not put too much reliance on release notes alone. If you do feel you've been victimized by me, I remind you that nobody is asking you to be a martyr for anyone's cause, and beg you to please step down off the crucifix.

It is the obligation of people who release code to the world to protect their users first effectively -- their good intentions are not enough. If the burden of this moral obligation is too much for you to take on, you are welcome to decline it and hand it off to others. But please get your Github in order and use it well. Don't treat this code as if you are just sharing some scripts with buddies and you know how it will be used in every possible case.

1 Like

Think you need to re-read and understand:

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

6 Likes

I do not understand how that is possible at this point.

With that out of the way... :slight_smile:

Thank you for your feedback. It seem most of your issues stem from assumptions about the GitHub repo, which does not match up with reality of my project or most Hubitat "packages." I understand that this is not how you want it to work, but it's how it does, and that is unlikely to change given that I am doing this entirely in my free time (and some features like "GitHub releases" take particular effort to create and tend to be done only when I remember is there is a good reason, like making v4.2 easier to access). As I note in the readme there, the Hubitat Community is the best place for discussion. I have been trying to do a better job of keeping the first post updated with important changes, since I realize digging through the entire topic is not practical for most people. I do not use GitHub issues, PRs (again, it's just me), or make much use of the platform other than as a place to host and share the code in the first place. This is quite common among Hubitat users.

That's all the promise you'll get from me. :slight_smile: That and that I tend to follow something vaguely like semver, so if you see 4.x to 5.x, you'll want to check for sure -- not that I don't recommend for any update, especially in environments as as described above. I again understand that your expectations may be different, so I'm just stating these facts (and repeating the fact that the code is offered as-is per its terms) so you can evaluate these against your expectations to make the best choice for yourself.

14 Likes

So not getting that neural interface I want eh? Guess I'll stop using it or build my own fork since this statement doesn't match with my perceptions... Thanx for nothing... :rofl:

5 Likes

I'll admit my first thoughts when things stopped working on my HE hub after the automatic update was applied to Coco-Hue, apart from "what have I broken now?" :-), was that I felt v4 to v5 could have perhaps been handled in a similar way to how HE treat breaking changes in apps like RM, releasing the new version as essentially a new app, possibly with a migration path. This would allow existing users to continue to run happily on v4 and choose when to make the move.

The more I thought about this over a relatively short timeframe, there were a few things that did not make this an attractive option:

  • Primarily it was that it would likely be a painful exercise for both the developer (@bertabcd1234 ) and the user to manage the transition from one instance of Coco-Hue to another on the same hub, if that would even be possible
  • This would pose a burden on users who may not be adversely affected by the changes in the new version, having to install and configure a new instance of the App for no reason related to their setup

As I went through the process of restoring a backup and putting a hold on automatic updates to Coco-Hue in HPM while I did some more reading, this step in particular made me realise this was the thing I was missing.

Coco-Hue, once it is setup, has just worked, for me, so I have not frequented the Community topic that often, unless I am making a change to something or just out of interest, so I am not always up to date on the conversation about changes be made. For most integrations I don't mind automatic updates flowing, particularly for less critical elements of my setup like.... most of my code :slight_smile: , but when it comes to my lighting setup, that's something I should be putting some effort into reviewing before applying updates, IMO.

So I'll be leaving the automatic updates off, not out of any concern over the quality of the app / drivers, purely because of the significance of what it does in my home. I will still get notifications when updates are available, so I can be prompt in applying them if I want to.

1 Like

I gave it my best shot.... :wink:

2 Likes

Me neither. For a person who claims to be very intelligent (repeatedly), he either isnā€™t, or is perhaps pretending to be obtuse because it suits his needs.

6 Likes

Couldnā€™t have said it better myself.

4 Likes

Would anyone see any value in adding "on" and "off" commands back to the scene driver as effectively momentary-only commands?

Yes, definitely. This would restore the easy integration with Alexa, Google Home, ActionTiles, etc.

I just created virtual switches for all of my scenes that when turned on press button 1 on the scene. They then automatically turn off after 5 seconds with "off" doing nothing.

I cannot thank you enough for the countless hours you've put into this project and the engagement with the Hubitat community! :raised_hands: :raised_hands: :raised_hands: :raised_hands:

4 Likes

I guess I am affected by the update as well.
I have a button in the bedroom that turned a scene on with one push, another with a dbl click, and another with a hold. Those same button presses used to turn the scene off (toggle).

This is now broken, and I can only turn on a scene with a push, or dbl push, and use another button to turn light off altogether.

So, big question: will this ever come back, or be restored in the future?
I guess I do not really know why this came about, and probably if I did I would understand it better.

A toggle won't work anymore nor will it in the future. Hue doesn't track state of scenes internally and the CoCoHue Hubitat implementation of scene tracking was removed.

You'll need to change your logic to turn off the lights that are part of the Hue scene. Hubitat's scenes have state, so you could use a toggle with them, but you'll need to do some specific configuration to keep track of external scenes set by buttons.

1 Like

Changelog details (and related information) is always available to review in the first post of the main CCH thread.

1 Like

Thank you for the reply.
I guess I keep asking because: It did before, and I am not sure why it cannot again.
Did Hue make a change?

With respect, did you read any of the "See this post" links in the changelog for more details?

1 Like

As I've mentioned elsewhere, this is unlikely to come back. It's not just that Hue doesn't track scene states (which wouldn't be as relevant for commands) but that they have never had a concept of de-activating or "turning off" a scene, only activating. The behavior of the "Off" command before was a best-guess, trying to find associated light IDs if it was a certain type of scene in the V1 API, the associated group if it was another type of scene in the V1 API, and eventually possibly the group ID that owns the room or zone that owns the scene if using the V2 API. It was always tricky, but trying to add this third thing (with two additional pieces) was really starting to make things messy. And that's all without worrying about the current state of the device. :smiley:

The solution is to actually do what you want directly instead. In most cases, this would mean turning off the associated group (or perhaps lights) rather than the scene device. Think of them as momentary activators. I'd encourage use of push(1) rather than on() to activate, though either continues to work and ultimately does the same. But it might be more helpful to think of it this way since that is what makes off() not quite make sense.

This mirrors how things work in the Hue app, too. Note that scenes can only be activated. If you want to turn something off, it's the room/zone or lights. If anything, "off" would make the most sense to stop a dynamic scene, but I don't know how I'm going to implement that eventually (probably not this way since it seems like it would be too confusing now).

If you don't mind being stuck on the mostly the V1 API, continuing to use version 4.2 (note that you must restore a hub backup and not just downgrade the code -- or at least restore your DNIs to what they were) is another option. You can even convert your existing uses of on to button pushes (probably not really needed anymore but not a bad idea...) and replace your offs with whatever you actually want, since this has always worked in any version (and has always been my recommendation). Then an upgrade to 5.x wouldn't have any changes for you should you do so eventually.

(Not to get anyone's hopes up, but despite all the above, I'm still trying to fetch all the data in both API versions that might actually make simulating this behavior again possible, including in the V2 API, so if that populates successfully for everyone, there's hope. But I'd rather not go down that rabbit hole if not necessary. :slight_smile: )

There is significant discussion of these changes in the posts linked to above by others (mainly those linked to from the first post in the main topic, as the HPM changelog also requests you to look at), so hopefully that can shed more light if you have more questions.

3 Likes

I did. I just kept seeing that a function was removed, and, until a recent reply to me, did not understand why

Thanks for the app. I'm sure as these things grow and evolve they can become unmanageable. My inconvenience with 5.1 was the loss of PresetColorTemperature. Loved that I could manage color temps without turning on the bulbs. About a half hour of fiddling with a few button controller settings and a rule machine tweak or two and it's all good.

2 Likes