Hello community,
i have a question about creating my first rule and have absolutely no idea where to start.
I would like to transfer a value from a String Item to a Number Item every time the value in the String Item changes.
I ask about the string item e.g. the available storage space. As an example I get 45% back and would like to transfer this value to a number item for further use.
Unfortunately, I have not found any examples in the openHAB documentation or here in the forum that could help me.
This is what i tried:
rule “Konvertiert den Ausgabewert in den Ausgabestatus”
when
Item AeonSD_Output changed
then
// post the new value to the Number Item
AeonSDBelegung_RCkgabestatus.postUpdate( newValue )
end
And so far only 0 comes out in the display. The value should be transferred one to one at the end. So 45% = 45%.
Can someone tell me where my mistake is?
Looks like your problem is newValue. This is not a recognized variable unless you have defined it somewhere else in your rule file. I suspect what you were looking for is the implicit variable newState
Also, for future posts, please try to use code fences as it makes the posts much easier to read and troubleshoot.
Thanks for your quick answer. Unfortunately, the code buttons are not visible to me, so I’ve never seen them.
I’m trying to get it right now.
rule "Konvertiert den Ausgabewert in den Ausgabestatus"
when
Item AeonSD_Output received update
then
// post the new value to the Number Item
AeonSDBelegung_RCkgabestatus.postUpdate(newState)
end
This is what the rule looks like now, but unfortunately the result is still 0. Is it important to mention that I query the value via the exec binding?