openHAB 4.0 Milestone discussion

Have a look on my comment…
MAybe this also works for you?

The last issues for me are with Amazon Echo Control and Kodi Binding:

2023-07-20 18:14:20.988 [WARN ] [core.thing.internal.ThingManagerImpl] - Channel types or config descriptions for thing 'amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX' are missing in the respective registry for more than 120s. In case it does not happen immediately after an upgrade, it should be fixed in the binding.
2023-07-20 18:14:20.999 [WARN ] [core.thing.internal.ThingManagerImpl] - Failed to normalize configuration for thing 'amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX': {thing/channel=Type description amazonechocontrol:lastSpokenText for amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX:lastSpokenText not found, although we checked the presence before.}
2023-07-20 18:14:21.025 [WARN ] [core.thing.internal.ThingManagerImpl] - Channel types or config descriptions for thing 'amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX' are missing in the respective registry for more than 120s. In case it does not happen immediately after an upgrade, it should be fixed in the binding.
2023-07-20 18:14:21.038 [WARN ] [core.thing.internal.ThingManagerImpl] - Failed to normalize configuration for thing 'amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX': {thing/channel=Type description amazonechocontrol:lastSpokenText for amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX:lastSpokenText not found, although we checked the presence before.}
2023-07-20 18:14:21.065 [WARN ] [core.thing.internal.ThingManagerImpl] - Channel types or config descriptions for thing 'amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX' are missing in the respective registry for more than 120s. In case it does not happen immediately after an upgrade, it should be fixed in the binding.
2023-07-20 18:14:21.077 [WARN ] [core.thing.internal.ThingManagerImpl] - Failed to normalize configuration for thing 'amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX': {thing/channel=Type description amazonechocontrol:lastSpokenText for amazonechocontrol:echo:XXXXXXXXXXXXXX:XXXXXXXXXXXXXX:lastSpokenText not found, although we checked the presence before.}
2023-07-20 18:14:21.100 [WARN ] [core.thing.internal.ThingManagerImpl] - Channel types or config descriptions for thing 'kodi:kodi:9849245e' are missing in the respective registry for more than 120s. In case it does not happen immediately after an upgrade, it should be fixed in the binding.
2023-07-20 18:14:21.103 [WARN ] [core.thing.internal.ThingManagerImpl] - Failed to normalize configuration for thing 'kodi:kodi:9849245e': {thing/channel=Type description kodi:volume for kodi:kodi:9849245e:volume not found, although we checked the presence before.}

lastSpokenText channel does not exist. Try to recreate your thing.

I recreated Amazon Echo control Things and also Kodi Things. This fixed the issue…

After the recreation of all Things including Bridge everything is okay

2 Likes

I’m not sure if this is a regression in 4.0, but I never saw this behavior before and it’s driving me nuts trying to pinpoint the cause.

Given this channel type:

items/repro.items:

Number:Time Repro_Direct                    <time> {channel="miele:washingmachine:home:washingmachine:elapsed"}
Number:Time Repro_Label   "Label"           <time> {channel="miele:washingmachine:home:washingmachine:elapsed"}
Number:Time Repro_Pattern "Pattern [%1$tR]" <time> {channel="miele:washingmachine:home:washingmachine:elapsed"}

sitemaps/repro.sitemap:

sitemap repro label="Repro" {
    Text item=Repro_Direct
    Text item=Repro_Label
    Text item=Repro_Pattern
    Text item=Repro_Direct label="Override [%1$tR]"
}

I get this result in the Android app (version 3.7.0):

The first two versions which are based on the state pattern from the channel description has an additional space: “00_:00”. The last two versions which overrides the pattern by the exact same pattern either in the item or directly in the sitemap don’t suffer from this issue.

What am I missing here?

I’ve updated the values from the console. e.g.:

openhab:update Repro_Direct "0 min"

and it doesn’t seem data related.

Same result with Basic UI ?

Yes:

Check pattern item metadata, it should apply.
Might be related to UoM OH4 changes (introduction of unit metadata, check that one on the item out, too)
But working with Number:Time has always been highly complex and full of surprises.

I had a thought that it might be related to localization because I didn’t check that previously, and found inconsistent default translation - fixed here:

I then also tried with the pattern “%1$tH:%1$tM” in my item definition, and this introduces the problem. I think this pattern used to display “00:00” rather than “00 :00”.

Hi,

I get the following error, when this rule file is parsed. It was working in Openhab 3.4.4. Error occurs in 4.0.0 M5:
Error:

 Script execution of rule with UID 'System-1' failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.BooleanExtensions.operator_equals(boolean,boolean) on instance: null in System

Rule Code:

// Boolsche Variable zum unterscheiden ob das System neu gestartet oder Items reloaded wurden
var Boolean SystemGestartet = false

rule "Bei Systemstart"
when
    System started
then
    //logInfo("System.rules", "System Start Rule wird durchlaufen. Wert Variable " + SystemGestartet)
    if ( (SystemGestartet == false) ){
        // Hilfsvariable auf true setzen. Somit wird dieser IF Zweig nur beim Systemstart durchlaufen
        SystemGestartet = true
        createTimer(now.plusSeconds(30), [|
            logInfo("System.rules", "Das Openhab System wurde gestartet")
        ])
        // Systeminitalisierung zeitverzögert starten
        createTimer(now.plusSeconds(240), [|
            sendCommand(i_System_Init, ON)
            logInfo("System.rules", "Systeminitialiserung nach Neustart Openhab durchgeführt")
        ])
    } else if ( (SystemGestartet == true) ) {
        logInfo("System.rules", "Items wurden neu geladen")
    }
end

Looks like the “Rule Trigger” System started isn’t working.

If I change the rule to

// Boolsche Variable zum unterscheiden ob das System neu gestartet oder Items reloaded wurden
var Boolean SystemGestartet = false

rule "Bei Systemstart"
when
    //System started
    Item i_Testswitch changed from OFF to ON
then
    logInfo("System.rules", "System Start Rule wird durchlaufen. Wert Variable " + SystemGestartet)
    
    if ( (SystemGestartet == false) ){
        // Hilfsvariable auf true setzen. Somit wird dieser IF Zweig nur beim Systemstart durchlaufen
        SystemGestartet = true
        createTimer(now.plusSeconds(30), [|
            logInfo("System.rules", "Das Openhab System wurde gestartet")
        ])
        // Systeminitalisierung zeitverzögert starten
        createTimer(now.plusSeconds(240), [|
            sendCommand(i_System_Init, ON)
            logInfo("System.rules", "Systeminitialiserung nach Neustart Openhab durchgeführt")
        ])
    } 
    else if ( (SystemGestartet == true) ) {
        logInfo("System.rules", "Items wurden neu geladen")
    }
    
end

it works!

I also tried, but this also fails:

when
    System reached start level 100
then

I guess the “System started” Trigger has changed from OH 3.4.4 to OH 4.0.0M5?

Check on which startlevel you are:

{
  "systemInfo": {
    "configFolder": "/etc/openhab",
    "userdataFolder": "/var/lib/openhab",
    "logFolder": "/var/log/openhab",
    "javaVersion": "17.0.7",
    "javaVendor": "Raspbian",
    "osName": "Linux",
    "osVersion": "6.1.21-v8+",
    "osArchitecture": "arm",
    "availableProcessors": 4,
    "freeMemory": 102176664,
    "totalMemory": 946147328,
    "startLevel": 100
  }
}

I am using level 50 which works without any issues:

rule "System start"
when
	System reached start level 50
then
...
	logInfo("EXTRA", "System started rule ausgeführt")
...
end

2023-07-21 08:27:35.291 [INFO ] [org.openhab.core.model.script.EXTRA ] - System started rule ausgeführt

Further testing, all starting level triggers seem to be okay:

rule "System start 100"
when
	System reached start level 100
then
    logInfo("EXTRA", "System started rule Level 100 ausgeführt")
end

rule "System start"
when
    System started
then
    logInfo("EXTRA", "System started rule ausgeführt")
end
2023-07-21 17:31:23.625 [INFO ] [org.openhab.core.model.script.EXTRA ] - System started rule ausgeführt
2023-07-21 17:31:28.963 [INFO ] [org.openhab.core.model.script.EXTRA ] - System started rule Level 100 ausgeführt

Works for me too, but Not If a global Boolean variable is definded.
Maybe you can define a global Boolean variable as in my example above?
Then Set the variable in rule

System started fires twice…

That is above my paygrade :slight_smile:

First things first: Your rule will not work as intended. In fact it never worked as intended.

System started is triggered once when the system is started.
Prior to openHAB3 it was also started, when the .rules file with the rule in question was reloaded.
It was never triggered through an item reload. See

So, the Boolean definition would also be reloaded, what would result in a SystemGestartet state false :slight_smile:

But in question of the Boolean global var in openHAB4-M5, I can give affirmation that it works flawless, at least for me. Maybe you have code above the var definition?

Some additional thoughts:

  1. It’s written openHAB, not Openhab, not OpenHab :wink:
  2. When using a Boolean, you can use it as is:
var Boolean bTest = false
if(bTest)  logInfo("test","bTest is true")
if(!bTest) logInfo("test","bTest is false")
bTest = !bTest                              // toggle from false to true or the other way
  1. logs… Please don’t write rules as the logger name.
    Every logger name from .rules files starts with org.openhab.core.model.script, the first string from a logX() action is added to this fix string, this would result in org.openhab.core.model.script.System.rules, keep it simple…
  2. if you want a value to be displayed in a log, use substitution:
logInfo("test","value of bTest is {}",bTest)

or convert to a string:

logInfo("test","value of bTest is "+ bTest.toString)

Be aware that primitives do not have any methods, so this will fail:

var int i = 4
logInfo("test","value of i is "+ i.toString)

but this won’t:

var int i = 4
logInfo("test","value of i is {}", i)

This has changed back to the old behavior at least in the latest snapshots. I think perhaps in the most recent milestone.

When the rule is loaded if the run level has passed, the rule get triggered, even if the run level was reached hours or days ago now.

There is a bug that was just fixed where when you save a UI rule it would try to run it and fail because the saved rule is still initializing. The docs might need to change to make that clear although as currently written it’s a little ambiguous.