Control variable

Hi
In my idea i want to use variable (nubmber, integer). And change it from basicUI and use it in rules.
To do this, I created new number item and try to change it by using Setpoint or slider. But it doesn’t work :frowning:
Can anybody help me?

Welcome to the OH community.
From that bit information it is impossible to help you. Please read this first:

Make sure you post your

  • items definition
  • sitemap
  • rule

then it will be more likely that somebody can help you

There is a little trap with setpoints and Number Items. All Items are created with NULL state. With no binding or restore to change that, the setpoint widget doesn’t work properly in most versions today.
You’ll need to postIpdate it with some initial value.

rule “init items”
when
System started
then
if(myItem.state == NULL) {
myItem.postUpdate(99)
}
end

another option especially for setpoints is to restore from persistence. Just persist the items you want (mapdb will suffice) with

strategy = everyChange, restoreOnStartup

This will restore the items to its status it had before openHAB was restarted.

Absolutely … but to persist anything useful you still have to get over that first hurdle to escape NULL.
The little rule I suggested will do that, but not interfere with restores. Use both.

Thank you!
Advice with mapdb really helped me.