openHAB 4.0 Milestone discussion

It also has the undesirable side effect of reloading, and therefore closing, the accordion list if it is in one

For my part, it is only an issue with repeaters that make extensive use of metadata (which I do have many of) because changes to metadata will not otherwise trigger a redraw (naturally). I’m not sure any of these would be a useful test outside of my system, but I should be able to put together a concise demo widget sometime later today.

Do you want me to just put it in a new issue on the repo?

Yes please.

@JustinG @MartOs
I’ve fixed the regression whilst keeping the benefits from #1904:

This IMO is the expected behaviour since metadata is not really meant to be used to store data dynamically.



I agree. I just have so many system setting type metadatas that I prefer to be able to manage them via UI pages on the rare occasions when they do change. So, I like to see those changes reflected without a full page refresh which is solved much more elegantly by the key property than a metadata change event.

1 Like

I made this: OH4 M2&M3 influxDB restoreOnStartup fails. Timeout exceptions in startup logs

Forgive me if this isn’t the right place to post but I’m struggling with units of measurement as it relates to humidity for several of my items in OH4. I posted previously and rlkoshak linked me to the current documentation (thx!) including this thread.

For example my ecobee thermostat sensors have items that are type = Number:Dimensionless, class = measurement, property = humidity. Prior to OH4 these reported correct correct quantity and units, eg. 49%. However in OH4 these now report 0.49.

I understand that I should be using Unit metadata to set these but I’m not having any success with the units setting of (Percent + ’ %').

Can anyone suggest the proper units metadata code?

I had a similar problem with with memory percent. I just went to number from number:dimensionless. Not sure about the metadata part.

Hello all,
Can I configure the new scene feature only in the main gui or als possible with files?

1 Like

Greetings all, to everyone, especially Kai, thank you for your tireless efforts on OH! I’m in the process of upgrading to OH4 now from 3. The question I’m about to ask may end up needing to be moved, as it regards jsr233/jython and the helper libraries and their compatibility with OH4.

After installing OH4.0.0-SNAPSHOT (I couldn’t figure out where to download M3… the download page says M3, but links you to the SNAPSHOT, but it seems stable enough…) I started slowly firing up the system, adding my bindings, items, etc. No issues yet. When I copied the “helper” libraries over, it began processing and loading them all. It actually went very smoothly except for one error that I have noticed so far.

The conf\automation\jsr223\python\core\components\ file threw an error while loading.

This is the offending block of imports:

    from org.openhab.core.service import AbstractWatchService
    from org.eclipse.smarthome.core.service import AbstractWatchService

Basically, OH4 no longer has ‘AbstractWatchService’, so it caught that error, and then since this is not OH2.5 there is no longer ‘eclipse.smarthome’ and an unhandled error was generated. This isn’t a big deal, but I like things to work, so I started looking around in the binaries, and indeed could not find a ‘AbstractWatchService’ but could find a ‘WatchService’, so i adjusted the block of code to read:

    from org.openhab.core.service import WatchService as AbstractWatchService
    from org.eclipse.smarthome.core.service import AbstractWatchService

Now it loads just fine, and I decided I’d try to see if it works. After finding the example for Directory trigger in the community here, I set it to watch the \conf\scripts folder, and to trigger on ‘ENTRY_CREATE’, ie when a file is created in the directory. When I add a file to the directory it clearly sees the ENTRY_CREATE event and starts processing, but instead of causing an OpenHAB event, it throws an error:

Detected invalid event (hash must not be null for CREATE/MODIFY): DirectoryChangeEvent{eventType=CREATE, isDirectory=false, path=C:\OpenHAB\conf\scripts\New Microsoft Excel Worksheet.xlsx, count=1, rootPath=C:\OpenHAB\conf, hash=(null)}

It seems like it’s so close. I’m wondering if this has to do with certain arguments the “WatchService” is looking for vs. what the “AbstractWatchService” Sends. Anyways, I can do further testing or send other data if needed.

If anyone has any news on if there are updated jython scripting helper libraries in the works for OH4, please let me know.

I have prepared this draft, I don’t know if it can help, because it don’t know what you mean by “units setting of (Percent + ’ %')”. Did you try to set unit to %?

Number:Dimensionless Relative_Humidity "Relative Humidity" { channel = "myweatherbinding:hygrometerthing:humidity" }

might need adjustment when channel is of type system.atmospheric-humidity because it has state description “%.0f %%” and system default is “Abstract unit one (one)”. Set the unit metadata to %:

Number:Dimensionless Relative_Humidity "Relative Humidity" { unit="%", channel = "myweatherbinding:hygrometerthing:humidity" }

It is UI only, but basically it is just another „look“ for the rules editor and using rules under the hood. If you want to have the same functionality file-based, just create a rule in your favourite language with no triggers that commands the given Items to a defined state and set the „Scene“ tag on it.

Is there an example?

What ist the benefit of the scene tag? I have a rule which starts at morning/evening/night time and I do everything in there what I want to do for the morning/evening/night

So maybe I was not really involved in the discussions

Thx for the help. I resolved the issue, it turns out I needed to do a full cache clean and restart to have the units metadata take effect. But the humidity values are displaying fine now.


Try escaping the percent sign (Percent + ’ %%')

Unfortunately Jython support is largely abandoned. I know of no one who is actively supporting either the add-on nor the Helper Library. But when you figure this out I’m sure @CrazyIvan359 will accept a PR to the Helper Library.

Rules DSL:

rule "My Scene"

It will show up under the Scenes page in MainUI instead of in the Rules page.

1 Like

Same here. Upgrade from 3.4.4 to 4.0M3 . The gateway cannot be initialised. But the whole thing in a Docker environment Docker version 24.0.2, build cb74dfc x64.

I need to declare “My Scene” first in the Main gui or can I declare it also in a text file?

It’s just a rule like any other. From the UI’s perspective, the only thing that makes it special is that “Scene” tag.

My example above is everything you need to do. You should never (and frankly cannot) mix UI and file based.

I can state the answer to your original question differently. No, you cannot create a Scene in a text based rule. Scenes as implemented in the UI, are only supported by the UI.

However, you can create the exact same capability in a file based rule as shown above. Create a rule with no triggers that command the Items to the desired state for that scene. If it’s supported in the rules language of your choice, add the “Scene” tag to the rule, though don’t expect it to show you much in MainUI under Scenes because the structure expected there is different from your file based rule. As with all file based rules, it’ll be read only also. Also, if you are using file based rules, why look at it in the UI in the first place?

1 Like

How to trigger than the scene?