Thoughts on upgrading bindings to use new UoM features for Humidity

Been there myself plenty :slight_smile: stick with it please as your contributions are valued greatly. Thanks.

This was raised in this github issue here as one of the dot points which I see @AndrewFG commented in there and hence is already aware. I have not read the history in the thread.

Many bindings in similar positions and not just humidity. This could also be a key reason why when v3 got introduced, we saw people going to another software package as easier then upgrading to v3 when rules needed editing due to datetime migration and channels to UOM. I escaped this because I was doing development and needed to delete and re-add things so often for testing, and getting new channels to show up, that I just adopted using defaults and making sure the bindings used nice names where possible instead of random UID values. I also do not care about historic values.

V4 did introduce Thing Upgrades, but many bindings devs don’t know it is there till they submit a PR, where does news of this get posted BTW? I myself have no idea of the scope of what it actually does until I just speed read the source code changes the PR made just now. Actually this feature has made me go Aargh and not want to implement changes, as now a 5 minute change turns into a 3 hour change as I need to look into how to do the update.xml only to find out what the reviewer of the PR is asking is not actually supported and possible.

When upgrading a channel from Number to Number:Dimensionless, that contains PercentType/DecimalType to now values of QuantityType<>

So there are 4 changes and please someone correct me if I am wrong but only the first 1 is actually automated and solved by the framework:

  1. Thing need updating so the channel shows up correctly, this can be automated with above feature.
  2. Items need to be changed to the new type.
  3. Items linked to the new/changed channel in the case of where the name of channel has changed.
  4. Historical data converted to work with the new item.

As for suggestions on ways forward:

You could leave the PercentType channel alone and add a new channel that has the newer support, now having to maintain two channels that do the same thing. I also believe its possible to hide a channel so new users do not see it and do not add it, but it keeps working as is. You could then add a WARN/INFO when the old channel is used to ask the user to migrate over to the new channel when they have time.

You/anyone/someone could extend the automation of the framework so that all the bindings do not get hit the same way, and its also temperature and many more. I am not capable of making such changes, still learning.

You could leave the channel alone if no one is asking for it to be upgraded, then the users must be happy. I doubt this is true as we have spent years telling users off for asking for new stuff in the forum.
We need to spend time where it is most valued or helps our own home. So if possible instead of changing 1 or x bindings, the time to even take the automation of thing changes up another level.

If the intention was to never add further automation to ease breaking changes, then we may as well have just automated a delete and re-add thing with same UID feature and gained an improvement without lumping extra coding onto all binding devs. It would also be nice if a channel keeps the same name and changes types that the binding dev does not need to add it to the XML and the core just handles it automatically especially for such common situations like temp and Humidity.

Of course this whole automating a breaking change is funny in a way to me because we should also consider what happens when a user wants to roll back, all of a sudden our upgrades and converting of historical data needs to be reversed or we now have what Home Assistant appears to have put the marketing spin of that they now have no “breaking changes” to now we only have “non backwards compatible changes”. This is less important here in openHAB as we can roll back just problematic bindings and addons keeping the upgraded core, in HA land you have to roll the entire lot back if any one of your 30 bindings have an issue and its pretty common that you do want to roll back compared to what happens here.

I got asked to add such a change in a PR to add it to the update.xml and as of last month it was not possible. If you anyone wants to know what is possible, this file outlines it…
https://www.openhab.org/schemas/update-description-1.0.0.xsd

Completely agree, so don’t misunderstand me when I say we need a better way to announce new dev features possibly in this forum like we have new openHAB releases annouced. Then we also need a FAQ done or a thread to discuss them, so we know the scope and some common use cases and how it effects people that contribute. So 1 person tests and then can post so we all do not need to re-do the tests. I do not believe this is in the dev documentation yet.