openHAB 4.0 SNAPSHOT discussion

@J-N-K : I’m having some issues with the latest snapshot and units. I’ve dug a little, but not much.

I have an item:

Number:Dimensionless MasterDeckDoor_Battery "Master Bedroom Deck Door Lock Battery Level [%d %%]" <battery> (eMasterDeckDoorLock, gWarningVisibility_Battery, gInflux, gMapDB) [ "LowBattery" ] { channel="zwave:device:512:node150:battery-level", unit="%", alexa="BatteryLevel", homekit="Battery.BatteryLevel, Battery.BatteryLowStatus" }

When I inspect the item, though, this is what I get:

logger.info(MasterDeckDoor_Battery.unit) # %
logger.info(MasterDeckDoor_Battery.dimension) # javax.measure.quantity.Dimensionless
logger.info(MasterDeckDoor_Battery.state) # 30
logger.info(MasterDeckDoor_Battery.state.unit) # one

Showing this item in a sitemap, it displays as “3000 %”. I’m surprised that the item’s state has unit one, even though the item’s unit is %. I suspect that’s why when it gets displayed, it’s converting to percent again, and 30 is 3000%.

The linked channel is a vanilla Number type, so it makes sense that it’s sending a one unit type, I just thought that would get interpreted as the item’s unit on update. Perhaps that was part of CommunicationManager code that got ripped out?

I’ll check that. But it seems that the communication manager is doing too much here.

Edit: It works perfectly fine for me. I added the magic binding and linked the number channel of the chatty thing to a Number:Dimensionless item with metadata unit=“%”. Some updates are send as QuantityType with unit °C and rejected (because the unit is incompatible, which is correct) and the other ones are plain DecimalType between 0 and 100 which correctly results in

22:07:42.360 [INFO ] [openhab.event.ItemStateUpdatedEvent  ] - Item 'Magic_ChattyThing_Number_to_show' updated to 39.176797268355514 %

I just tried to update my 4.0.0.M2 to SNAPSHOT (On a Windows Machine) and get the following error from the update script:

Starting JSON database update...
Error: Unable to access jarfile C:\Users\Mark\AppData\Local\Temp\openhab\update\runtime\bin\runtime\bin\upgradetool.jar
Update-openHAB : Update tool failed, please check the openHAB website (www.openhab.org) for manual update instructions.
At C:\openHAB\runtime\bin\update.ps1:584 char:22
+ ...        exit Update-openHAB -OHDirectory $OHDirectory -OHVersion $OHVe ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Update-openHAB

I can confirm that the JAR file is in the specified location:

Checked the 4.0.0.0 Windows Install (and update) instructions nad don’t see anything there.

Please can you assist?

BTW I have reverted back to 4.0.0.M2 in the meantime.

EDIT:
Found this:

EDIT: Tried to run the UpgradeTool manually (from the TEMP folder and got the following:

PS C:\Users\p8900019\AppData\Local\Temp\openhab\update\runtime\bin> java -jar upgradetool.jar --dir c:\openhab\userdata --command itemCopyUnitToMetadata

Error: LinkageError occurred while loading main class org.openhab.core.tools.UpgradeTool
        java.lang.UnsupportedClassVersionError: org/openhab/core/tools/UpgradeTool has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Wrong Java version. Your runtime supports up to class file version 55, about probably is 11, not 17 (which supports up to 61).

Thank you. You are right. Java 11 was before Java 17 in the path, even though JAVA_HOME was correct. I suppose because the command was (takes first java in path):

java -jar C:\Users\p8900019\AppData\Local\Temp\openhab\update\runtime\bin\runtime\bin\upgradetool.jar --dir c:\openhab\userdata --command itemCopyUnitToMetadata

Do I need to run the command manually as it is not found using the path etc?

I changed to the directory and ran:

java -jar upgradetool.jar --dir c:\openhab\userdata --command itemCopyUnitToMetadata

Which produced:

[main] INFO org.openhab.core.tools.internal.Upgrader - Copying item unit from state description to metadata in database 'c:\openhab\userdata\jsondb\org.openhab.core.items.Item.json'
[main] WARN org.openhab.core.tools.internal.Upgrader - ShellyEM_MAINS_TotalEnergy_Monthly: State description contains unit place-holder '%unit%', check if 'unit' metadata is needed!
[main] INFO org.openhab.core.tools.internal.Upgrader - ShellyEM_UPS_TotalReturnedEnergy: Wrote 'unit=kWh' to metadata.
[main] INFO org.openhab.core.tools.internal.Upgrader - ShellyEM_UPS_VA: Wrote 'unit=VA' to metadata.
[main] WARN org.openhab.core.tools.internal.Upgrader - ShellyEM_UPS_TotalEnergy: State description contains unit place-holder '%unit%', check if 'unit' metadata is needed!
[main] WARN org.openhab.core.tools.internal.Upgrader - ShellyEM_MAINS_TotalEnergy: State description contains unit place-holder '%unit%', check if 'unit' metadata is needed!
[main] WARN org.openhab.core.tools.internal.Upgrader - ShellyEM_MAINS_TotalReturnedEnergy: State description contains unit place-holder '%unit%', check if 'unit' metadata is needed!
[main] WARN org.openhab.core.tools.internal.Upgrader - ShellyEM_Mains_TotalEnergy_PreviousMonth: State description contains unit place-holder '%unit%', check if 'unit' metadata is needed!

This seems to imply further action is required?

And, does the UpgradeTool have to be run while openHAB is shutdown?

ok I want to report that I’m running 3460 and as in above post I’m still experiencing the cpu getting pinned occasionally. It used to take only a day or two but now it goes a week. It does not crash the box or OH but things get sluggish. (host i3 HDD 8GB Dell desktop Mint Linux)
When I restart the host, I must manually set safeCall to 100 (default 10) as describe by Cody here I have the script from the bottom of that same post and if I manually run it when the CPU is pinned it calms down after a few minutes.
I have RDD uninstalled and influx installed
I use DSL and Jruby rules 48 things 240 items

This problem seems unique to me so I’m guessing it is something in my config which is an OH3 upgrade. If anybody wants me to investigate further, I’ll do my best but eventually if no one else reports it (which no one seems to be) I’ll probably just wipe it and start from scratch load fresh clean install and start adding stuff back

Some weeks ago I updated the well running OH snapshot version on Raspi 4 using openhabian. This ended with the appended message . The system is completely locked afterwards. When I make a fresh installation and manually copy all files to conf and userdata, everything works fine until I do an update again. Is there anything I should modify or delete before I make an update or do I have to generate all items again. I only use UI installation.

Press Ctrl-C/Strg-C and abort the script.

Please send the metadata.json to github@klug.nrw. I‘ll try to fix the NPE.

The modified script and upgrade routines are now working. I had to setup a new system , cause I couldn‘t convince openhabian to restart the upgrade routines.
The only disadvantage I have now, is that all metadata are gone, no expire dates or state descriptions.

Why is that? Did you use the metadata.json I send to your email?

I just tried it in the old system, but there I couldn’t run the script. I will try it in the new system later on. What I forgot to say, that all units from z-wave devices are gone except for temperature . There is not Voltage „V“ for electric.potential

The world is ok again. I copied the metadata.json file and it works ok. Thanks a lot.

1 Like

I made my first foray into openHAB 4 today. I loaded the SNAPSHOT 3842 using openhabian. I had previously updated to Java 17. It appears to have gone fairly smoothly.

The biggest obvious problem I experienced was when I went to add the smart home/j Tuya and AmazonEchoControl bindings. When I first went to the Add-on’s screen in the UI, the smarthome/j bindings were listed after the Community Bindings. A little while after I clicked on install on the AmazonEchoControl and Tuya bindings, there was an error message in the lower left hand corner. It didn’t stay, so I’m going from memory but it was something about JSON file error. After that, the smarthome/j bindings disappeared front the UI. I tried restarting openHAB, but that didn’t help.

I poked around looking for things that looked amiss. There are some references to 3.4 that seem out of place in:


openhabian@openhabian-spring:/var/lib/openhab/config/smarthomej $ cat AddonProvider.config
:org.apache.felix.configadmin.revision:=L"73"
installedAddons="smarthomej-binding-amazonechocontrol_3_2_4"
installedFeatureRepos="mvn:org.smarthomej.addons.features.karaf/org.smarthomej.addons.features.karaf.smarthomej-addons/3.2.4/xml/features"
service.pid="smarthomej.AddonProvider"


runtimeInfo:
  version: 4.0.0
  buildString: "Build #3482"
locale: en-US
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.6
  javaVendor: Raspbian
  osName: Linux
  osVersion: 6.1.21-v8+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 34531208
  totalMemory: 259522560
  startLevel: 70
bindings: null
clientInfo:
  device:
    ios: true
    android: false
    androidChrome: false
    desktop: false
    iphone: false
    ipod: false
    ipad: true
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    os: ios
    osVersion: "16.1"
    webView: false
    webview: false
    standalone: false
    pixelRatio: 2
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 7
    language: en-US
    languages:
      - en-US
    onLine: true
    platform: MacIntel
  screen:
    width: 1024
    height: 1366
    colorDepth: 32
  support:
    touch: true
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: true
    intersectionObserver: true
  themeOptions:
    dark: light
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15
    (KHTML, like Gecko) Version/16.1 Safari/605.1.15
timestamp: 2023-05-28T23:05:29.155Z

I have a few rules I need to sort out. I thought I went through and opened all of my Blocklies and saved them, but I’m still getting a few Errors.


2023-05-28 18:12:29.454 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - ScriptEngine for language 'application/javascript' could not be found for identifier: dd9beff2-1ccc-4b81-bac0-456fd51c723e
2023-05-28 18:12:29.513 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - ScriptEngine for language 'application/javascript' could not be found for identifier: 26aebbf6-1481-4b97-b875-dba3d20e5f41
2023-05-28 18:12:29.514 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - ScriptEngine for language 'application/javascript' could not be found for identifier: dbafca86-c651-4184-b303-9e7100185542
2023-05-28 18:12:29.518 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - ScriptEngine for language 'application/javascript' could not be found for identifier: dbafca86-c651-4184-b303-9e7100185542

I can’t connect the identifier to anything that would help me figure out which rule is causing the error. Is there some way to do that I’m missing?

Sorry for the slow reply - I never saw your edit. But anyhow, I figured it out today. I was wrongly assuming that if you don’t have the unit metadata set, it would infer the unit from the state description. As for my debugging… I found a bug in the Ruby helper library that unit is possibly calling the wrong method. So yeah, I think it was just a few things wrong on my end, and it seems to be working now. Thanks!

openHabian clean install on rpi4 OH4.0.0 #3483 with just EnOcean binding installed.

EnOcean USB300 dongle is automatically put to inbox with correct port.
The port is available and working.
But after adding thing “trying to get bridge base id …” does not work.

2023-05-29 09:53:19.298 [INFO ] [ernal.transceiver.EnOceanTransceiver] - EnOceanSerialTransceiver initialized

2023-05-29 09:53:19.300 [INFO ] [ernal.transceiver.EnOceanTransceiver] - EnOceanSerialTransceiver RX thread started

==> /var/log/openhab/events.log <==

2023-05-29 09:53:19.300 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'enocean:bridge:FT3OLRGB' changed from OFFLINE (CONFIGURATION_PENDING): opening serial port... to OFFLINE (CONFIGURATION_PENDING): starting rx thread...

==> /var/log/openhab/openhab.log <==

2023-05-29 09:53:19.301 [INFO ] [nternal.handler.EnOceanBridgeHandler] - EnOceanSerialTransceiver RX thread up and running

==> /var/log/openhab/events.log <==

2023-05-29 09:53:19.304 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'enocean:bridge:FT3OLRGB' changed from OFFLINE (CONFIGURATION_PENDING): starting rx thread... to OFFLINE (CONFIGURATION_PENDING): trying to get bridge base id...

Do you have the JavaScript Scripting add-on installed?

1 Like

No, I did not. Installing it appears to have resolved that problem. Thanks.

1 Like

Regarding enocean binding, I can find 3 changes in 2023:

EnOcean USB300 dongle “trying to get bridge base id …” does not work

It was reported to be working with OH 4.0.0.M1, but broken on OH 4.0.0.M2 and M3 …

I tested it with OH 4.0.0.M3 and OH4.0.0 #3483. Both show the error on a clean rpi4 openHABian install.

The thing status does not change afterwards? Can you set log:set TRACE org.openhab.binding.enocean on the karaf console and disable/enable the thing again? You can revert that log setting by exchanging TRACE with DEFAULT.