openHAB 4.0 Milestone discussion

OK, so oldValue is definitely a string and newValue is the result of a calculation of two Java Objects. @florian-h05, @stefan.hoehn, would it make sense to add an option to get the numbericState and quantityState to the “get state of Item” block?

Or perhaps access to a parseFloat block?

I suspect this is going to hit a number of users.

In the mean time you can use an inline script block with:

oldValue = items.getItem('WeatherStation_RainCounter').numericState
1 Like

just wanted to share I upgraded successfully from openHAB 3.4.1 runningon 32bit arm orange pi, to 4.0 M1 running as Docker container on x86 architecture. only issue I had was to create the logs directory in the userdata directory, otherwise the upgrade process wasn’t started.

Ok. Many thanks. Should i create an issue in github?

Updated from 3.4.2 to 4.0.0.M1 on Docker.
Everything is working great.
Exept I’m missing the shelly manager.
Is the shelly manager not part of 4.0.0.M1 anymore?

http://<openHAB IP address>:8080/shelly/manager

3 Likes

I get the same.

It looks revivable:

1 Like

Same here, shelly manager is not found.

It wouldn’t hurt.

Thx, Christian.
Can you please add the OH3 and OH4 code as well to the issue and a link to the forum here. I will look into the problem eventually with @florian-h05 .

2 Likes

Of Course! I added the JavaScript code

Hello,

I performed the upgrade to 4.0.M1. However, I have the following remnant from the darksky binding in my startup log. While it is little more than an annoyance I can’t find anywhere to surpress it. Any assistance would be appreciated.

2023-03-13 13:39:27.248 [WARN ] [core.karaf.internal.FeatureInstaller] - The binding add-on 'darksky' does not exist - ignoring it.

Kr,

See above: [Solved] OH3: How to get rid of old bindings? - #6 by wborn

Thank you! There were enough clues in the post to figure it out.
I had modified /var/lib/openhab/config/org/openhab/addons.config and removed the errant binding to no avail…but missed it in /var/lib/openhab/etc/org.openhab.addons.cfg

Thanks for the expedient response!

Kr,

Just some feedback on OH4.0 Milestone . I upgraded a 3.4.2 docker, of course I have a backup, container to OH4.0M1 and had very few issues. Contrary to what I have read, OH 3.2 bindings work with OH4. Not perfectly but almost. Maybe Im just lucky, but I side loaded 2 bindings that I have been using since OH3.2 and were compiled against 3.2. Both worked. I did have to feature:install openhab:transport.upnp or install the UPnP binding, but once UPnP was running both bindings worked, mostly. I did have one device that was not properly recognized and caused the bridge to flag Online-Offline which created issues for the devices using that bridge. But if I disabled that one device, the other 99 devices worked fine.

Another thing I noticed with these 2 bindings is that they did not allow me to manually add Things. The bindings did not appear when I clicked the “+” in the lower right on Things page. I was only able to add Things that were automatically recognized and in the INBOX. This may be because they were side loaded using the addons folder, or perhaps they were filtered out because they are 3.x bindings. I don’t know. Hopefully these minor issues will resolve with future updates, as otherwise everything went smoothly.

Running on in Docker on my Synology.
Since the update i get the following Warning every ~3seconds in my Logs:

2023-03-14 15:15:50.186 [WARN ] [.thing.internal.CommunicationManager] - No ProfileFactory found which supports profile ‘transform:JS’

Restarted, cleaned cache… how do i find the source of that warning?
I dont even know, where i probably use the “transform:JS” mapping (?)

The JS transformation is no longer supported. You have a Profile defined on at least one Item (maybe PS14_Power or ESP04_Feuchigkeit given the logs, or maybe some other Item that isn’t updating because of this problem) and this Profile is using the JS transformation. You’ll need to find it (in a pinch you can search through $OH_USERDATA/jsondb/org.openhab.core.thing.link.ItemChannelLink.json for “transform:JS”).

1 Like

Today I updated to the OH4 Milestone.

Regarding the Jython rules I had only a small issue in a file from the helper library: “AbstractWatchService” could not be imported in 100_DirectoryTrigger.py

try:
    from org.openhab.core.service import AbstractWatchService
except:
    from org.eclipse.smarthome.core.service import AbstractWatchService

I tried to locate the AbstractWatchService in the openHAB sources, but it seems as if it as been removed, at least I could not find it.

I will do some more testing in the next days.

See https://github.com/openhab/openhab-core/pull/3255 which might be relevant.

Thanks for pointing that out. It seems, as if the 100_DirectoryTrigger.py must be rewritten to use the WatchService class.

I tried to just replace the AbstractWatchService by WatchService but this (of course) does not seem to work. As I never used the DirectoryEventTrigger I am not sure if this is because of an error in my test code or the 100_DirectoryTrigger.py.

I got this example from the forum:

rule("Directory watcher example")
class DirectoryWatcherExampleRule(object):
    def getEventTriggers(self):
        return [ DirectoryEventTrigger("/tmp", event_kinds=[ENTRY_CREATE]).trigger  ]
    
    def execute(self, module, inputs):
        logging.info("Directory watcher example triggered")

Which throws an exception:

Cannot inform the listener "org.openhab.core.automation.internal.RuleEngineImpl$2@7d24c050" about the "REMOVED" event: AttributeError: 'Handler' object has no attribute 'watcher'
org.python.core.PyException: AttributeError: 'Handler' object has no attribute 'watcher'
	at org.python.core.Py.AttributeError(Py.java:178) ~[?:?]
	at org.python.core.PyObject.noAttributeError(PyObject.java:965) ~[?:?]
	at org.python.core.PyObject.__getattr__(PyObject.java:959) ~[?:?]
	at org.python.pycode._pyx419.dispose$11(/etc/openhab/automation/jsr223/python/core/components/100_DirectoryTrigger.py:87) ~[?:?]
	at org.python.pycode._pyx419.call_function(/etc/openhab/automation/jsr223/python/core/components/100_DirectoryTrigger.py) ~[?:?]
	at org.python.core.PyTableCode.call(PyTableCode.java:173) ~[?:?]
	at org.python.core.PyBaseCode.call(PyBaseCode.java:306) ~[?:?]
	at org.python.core.PyBaseCode.call(PyBaseCode.java:197) ~[?:?]
	at org.python.core.PyFunction.__call__(PyFunction.java:485) ~[?:?]
	at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[?:?]
	at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[?:?]
	at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[?:?]
	at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[?:?]
	at org.python.core.PyObject._jcallexc(PyObject.java:3565) ~[?:?]
	at org.python.core.PyObject._jcall(PyObject.java:3598) ~[?:?]
	at org.python.proxies.__main__$Handler$779.dispose(Unknown Source) ~[?:?]
	at org.openhab.core.automation.handler.BaseModuleHandlerFactory.ungetHandler(BaseModuleHandlerFactory.java:84) ~[?:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.removeModuleHandlers(RuleEngineImpl.java:616) ~[?:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.unregister(RuleEngineImpl.java:687) ~[?:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.removeRule(RuleEngineImpl.java:756) ~[?:?]
	at org.openhab.core.automation.internal.RuleEngineImpl$2.removed(RuleEngineImpl.java:277) ~[?:?]
	at org.openhab.core.automation.internal.RuleEngineImpl$2.removed(RuleEngineImpl.java:1) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.notifyListeners(AbstractRegistry.java:378) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.notifyListenersAboutRemovedElement(AbstractRegistry.java:412) ~[?:?]
	at org.openhab.core.automation.internal.RuleRegistryImpl.notifyListenersAboutRemovedElement(RuleRegistryImpl.java:304) ~[?:?]
	at org.openhab.core.automation.internal.RuleRegistryImpl.notifyListenersAboutRemovedElement(RuleRegistryImpl.java:1) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.removed(AbstractRegistry.java:272) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.removed(AbstractRegistry.java:1) ~[?:?]
	at org.openhab.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:63) ~[?:?]
	at org.openhab.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:79) ~[?:?]
	at org.openhab.core.common.registry.AbstractProvider.notifyListenersAboutRemovedElement(AbstractProvider.java:87) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.shared.ScriptedRuleProvider.remove(ScriptedRuleProvider.java:75) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.shared.RuleSupportRuleRegistryDelegate.removeAllAddedByScript(RuleSupportRuleRegistryDelegate.java:112) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.shared.ScriptedAutomationManager.removeAll(ScriptedAutomationManager.java:105) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.internal.RuleSupportScriptExtension.unload(RuleSupportScriptExtension.java:220) ~[?:?]
	at org.openhab.core.automation.module.script.internal.ScriptExtensionManager.dispose(ScriptExtensionManager.java:142) ~[?:?]
	at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.removeScriptExtensions(ScriptEngineManagerImpl.java:248) ~[?:?]
	at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.removeEngine(ScriptEngineManagerImpl.java:242) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.lambda$15(AbstractScriptFileWatcher.java:312) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

I will try to look into this, when I have more time.