Update from OH3 to OH4 - Blockly Math & State SitemapProblem

Hey friends. i have now Update from OH3.4.4 to OH4.3.2

After this Upgrade my Blockly Rules doesnt work anymore, because i have a lot of If Else Rules in MATH he Calculate the Addition False.

For Example.
OH3= 8+1 = 9
OH4=8+1= 81

But they are Number Items without Unit in Number Blocks (Not String Item). Minus going Right, but Plus going False…

I have Zulu17.0.13 and OH4.3.2 Any Ideas?!

Wenn i make 8-1 in OH4 they made 7. but wenn i will 7+1, he made 71…

EDIT:

I HAVE NOW FIND A NEW BLOCK IN MATH (NUMBER) the 2nd from Up.
He Convert the VariableNumber to a NumberNumber…

Must i all convert all Rules with variables the new 2nd NUMBER Block?!.. Okey…

Next Problem is on OH4 i can test if Icon works when i edit the name of a icon.

He made on sitemap after the new blockly math 2nd rule a Point.0 at the end of the state.

OH3=state was 600 and i see the post-600.png icon
OH4=state was after the new Blockly Math 2nd Rule 600.0 and he cant find a post-600.0.png icon, but when i go to Developer Tools and Test the Icon name post-600.0 i see it?! but not on sitemap…

I think OH4 Bug and Blockly Bug…

i have 2 years OH3 and i am hold to ignore the OH4 upgrade on raspbian. I think it was a good time to change to OH4, but 2 years ago i am was beginner and i dont want directly upgrade it from a few days first work with OH3. i would learn, but this is very fail… i tell (Only Update) and Nothing Works. Thats normally i think…

In OH 4 Blockly “compiles” to JS Scripting and the openhab-js helper library. One of the key differences is there is now several different ways to get the state of a Number Item. The default .state is always a String. However, the “get [name] of item” block also offers “numeric state” and “quantity state”.

If you need to do math, you want to use one of these blocks.

To be honest, you were previously depending on a unique feature of Nashorn that is not generic JS. There has always been that Number block. It’s just now that JS treats a String as a String instead of trying to auto covert it to a Number (and sometimes getting it wrong). But you should have used that number block from the beginning.

What’s your label? If it’s not %d it will treat the value as a floating point number.

I think the first change was discussed in the blog that covered all that’s new in Blockly in OH 4. I didn’t know about the second change but it’s not related to Blockly.

Hai,

i edit all my Variable Math-Rules with an additional Math Block (Number Blockly, 2nd from Up) and works now.

But i have sometimes the feeling that the Openhab 4.3.2 stop works for a few seconds any times when i was edit a Rule/Thing or Install/Remove a Binding. In Log i see:

Can’t get a WebContainer service from {org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer}={org.ops4j.pax.web.log.ncsa.extended=true, org.ops4j.pax.web.ssl.keystore.password=********, service.scope=bundle,

but i dont know what i can do i dont find a solution. I used Zulu17 on Raspbian ARM32HF. And openhab-cli console say (karaf):

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See SLF4J Error Codes for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/usr/share/openhab/runtime/system/org/apache/karaf/org.apache.karaf.client/4.4.6/org.apache.karaf.client-4.4.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): See SLF4J Error Codes for an explanation.

Can i Downgrade to 4.3.1 or is that so on this Version?

The SLF4J error is known and an issue is open for it. Also, is harmless and not causing the problem you describe.

How are the resources on your machine? If you run out of RAM and start using swap or if the system load is high it can exhibit this behavior.

Hai,

i check now RAM, SWAP and Heap. Thanks

Can you tell me if the SLF4J Error means the same like Can’t get a WebContainer service from {org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer}= in openhab.log?

Is It Possible to Disable Bindings or Things that no compatibile to OH4? I am see in log that when OH4 is stocks, any Things going Offline, and Online Back.

I used this OH4:

RuntimeInfo:
version: 4.3.2
buildString: Release Build
locale: de-DE
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 17.0.10
javaVendor: Azul Systems, Inc.
javaVendorVersion: Zulu17.48+15-CA
osName: Linux
osVersion: 6.1.21-v8+
osArchitecture: arm
availableProcessors: 4
freeMemory: 131893464
totalMemory: 316669952
uptime: 46346
startLevel: 100
addons:

  • automation-jsscripting
  • binding-astro
  • binding-avmfritz
  • binding-bluetooth
  • binding-exec
  • binding-fmiweather
  • binding-folderwatcher
  • binding-ipcamera
  • binding-mail
  • binding-mqtt
  • binding-novafinedust
  • binding-ntp
  • binding-shelly
  • binding-systeminfo
  • binding-tankerkoenig
  • binding-tr064
  • persistence-rrd4j
  • transformation-jsonpath
  • transformation-map
  • transformation-regex
  • ui-habpanel
    clientInfo:
    device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1.25
    prefersColorScheme: light
    isSecureContext: false
    locationbarVisible: true
    menubarVisible: true
    navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: de-DE
    languages:
    • de-DE
    • de
    • en
    • en-US
      onLine: true
      platform: Win32
      screen:
      width: 1920
      height: 1080
      colorDepth: 24
      support:
      touch: false
      pointerEvents: true
      observer: true
      passiveListener: true
      gestures: false
      intersectionObserver: true
      themeOptions:
      dark: light
      filled: true
      pageTransitionAnimation: disabled
      bars: filled
      homeNavbar: default
      homeBackground: default
      expandableCardAnimation: disabled
      blocklyRenderer: null
      userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
      like Gecko) Chrome/132.0.0.0 Safari/537.36
      timestamp: 2025-02-02T14:08:54.383Z

No, the SLF4J message is about logging.

If you are running OH 4, all of your bindings must be compatible it else you’ll have problems.

But assuming you do not have any jar or kar comes in the add-ons folder, all the l if your bindings are compatible with the version of OH you are running. If you do have fines in that folder, remove them.