I’m looking forward for the next OH release. I noticed in the milestone 1 release notes, that there won’t be any JS transformation support in OH 4.0, one should use the SCRIPT transformation instead. I want to prepare my current OH installation for the next release, to make sure I can use it when it is released.
Right now I use JS transformations as described here. In my current OH installation I have probably more than 500 items. I know, that some of them are controlled by three different JS transformations, which are installed as a profile “between” the channel an the item. All of my channels and items are build in the OH3 UI, I don’t have any configuration files.
I’m wondering what is the best way to find the channels, which currently make use of the JS transformations. Do I have to open every single channel of every thing in the OH3 Admin UI to find all of my JS transformation, or is there a more easy way?
I’m also confused about the advice to replace any current JS transformation by SCRIPT transformation. I can’t find a SCRIPT transformation in the OH 3.4.3 and OH 4.0.0 docs. What is meant by “SCRIPT Transformation”?
That’s brilliant news! But to be honest I couldn’t find this information in the release notes. Are you talking about issue 3249?
Thx, I’ll try that.
Ah, okay. I was looking at the wrong place. But there’s documented, that SCRIPT transformation is not available as a profile.
So what do I have to do to be prepared for OH 4.0? There will be JS transformations, but will they also be available in profiles if I install one of the JS automations? As SCRIPT transformations aren’t available in profiles I have to look for an alternative.
Script transformations are available in profiles, have a look at the very latest docs (@rlkoshak you pointed to the stable docs, but this is currently only in the latest docs): Transformations | openHAB
You may not need the toHandlerScript if you aren’t sending command to the item and only receive state updates.
It is supposed to go into the BREAKING changes list, but I don’t know where users should be able to see this. Its buried in there under [4.0.0] heading. I guess the upgrade experience for Milestone builds isn’t meant to be as polished.
As @JimT indicates, there is a slight change in the syntax as Profiles now support defining a different transformation each direction (Channel to Item and Item to Channel). You’ll also need to install one of the JS Scripting add-ons (I’d choose the GraalVM one).
The issue you did link to implements SCRIPT transformations as Profiles.
OP is on 3.4 so I pointed to those docs deliberately. OP can’t prepare for OH 4 by using syntax and capabilities that don’t exist in 3.4.
No, changes between milestones are not as polished. We will probably want to write am upgrade tutorial as we get closer to June but it’s probably too early to write right now as things are still changing pretty drastically and we don’t know yet what, if any automatic upgrades might be applied, freeing the need to document it in a tutorial. The final OH 4 release notes will have more details and there will be a corresponding blog post and perhaps more if the past is any indication.
When we went from OH 1 to OH 2 we added an upgrade tutorial to the docs. For OH 2 to OH 3 in leu of an upgrade tutorial we have the Getting Started Tutorial. I’m not sure what will be necessary for OH 3 to OH 4. Most of the new great things in OH 4 are additions but there are a few things like this and the unit changes might need some explanation and require work on the end user’s part.
Leave the current implementation of script profile in core as-is. So if it doesn’t find the toItemScript / toHandlerScript params, it will log a warning. This should be sufficient for text config people - they will need to adjust their config, although I do need to add the link details in the log message.
The benefit of this, is for those upgrading from openHAB3, they will automatically upgrade this transform addon, and those who didn’t use JS transform to begin with, are completely unaffected. This also means that people can upgrade from OH3 later on even if they waited until OH 4.3 is out, for example, as long as we keep the fake addon around so it can be installed / upgraded to.
I have already tested this solution on my system and it works. I’ll push it sometime tomorrow after I’ve written a unit test and readme for it.
Tagging @J-N-K here since we also discussed this in the PR and the PR will be closed.
OK, I opened the file org.openhab.core.thing.link.ItemChannelLink.json and searched for the keyword function. Like this I could easily find all my current JS transformations used in profiles.
I understood, that currently I’m not able to prepare for OH 4.0 concerning to this JS transformations in profiles. It looks like in future I have to use SCRIPT transformations in profiles, but they are not available for profiles in OH 3.4, I have to wait for 4.0. Maybe there will be a migration script, maybe not. We will see. I keep the eyes open to the release notes.