Update item from rule not working

I have defined two items, one is read using the HttpBinding (which works fine).
The second item should be updated via a rule.


Number Kostal_OperatingStatus "Betriebsstatus [%d]" { http="<[kostalCache:60000:JSONPATH($.dxsEntries[4].value)]" }
String Kostal_OperatingStatusString "Betriebsstatus unbekannt"


rule "Update Item Kostal_OperatingStatusString"
Item Kostal_OperatingStatus received update
Kostal_OperatingStatusString.sendCommand("Betriebsstatus dummy")


Text item=Kostal_OperatingStatus
Text item=Kostal_OperatingStatusString

The sitemap shows correct values for the item “Kostal_OperatingStatus”, but the item “Kostal_OperatingStatusString” always has its initial value of “Betriebsstatus unbekannt”.

I already tried using “changed” in the rule instead of “received update”, but that did not help.
Using “postUpdate” instead of “sendCommand” also did not help.
Any ideas what could be the reason for the item Kostal_OperatingStatusString to not update?


Does your rules file load?
Look in your openhab.log for messages about initial file load, or refreshing after edit.
No message, no rules.

Does your Item Kostal_OperatingStatus ever change?
Look in your events.log for messages that show that.

Does your rule trigger?
Normally you’d place logInfo() to follow progress, but with a rule this simple that is unnecessary.
Either it messes up the sendCommand() and leaves a message in your openhab.log, or it does it and leaves a message in your events.log

The rule file gets loaded with no errors.
The item Kostal_OperatingStatus did not change (it will change in the evening), but I restarted Openhab, so the initial value got set again, but the rule seems not to get triggered.

Maybe just wait to see if a real change of the item triggers the rule?

You have to set the label to show the state.

OK, I changed my item definition to

String Kostal_OperatingStatusString "Betriebsstatus [%s]"

For testing I have added a switch item to the sitemap, that triggers my rule.
The rule is now like this:

rule "Update Test"
Item RS_KOSTAL received command
logInfo("Kostal_OperatingStatus", "rule was called")

Now it seems to work :slight_smile: