Rules do not trigger

Hi, I’m quite new to Openhab and I can’t get my first rules to trigger. Maybe someone can help me.

The first rule should set the Gang_Soll item to 20 by startup but when i reboot the System this Item does not have any Value. The Second Rule should trigger when one of the items change in value via a setpoint in the Sitemap but even if I remove the if comparison it does noch set the HeizungGang Item to ON

Cool you are nearly there.

    System started
then

    Thread::sleep(30000)
    if blah foo bar 

Next Rule you don’t need the or after Gand_Soll

Items always have some state, but you might need to find out what exactly.

if (Gang_Soll.state == Uninitialized) ...

You’re following a very old tutorial, I suspect.

In openHAB-1, newly born Items at system startup time have a state of Uninitialized.

In openHAB-2, they have state NULL

You can use logInfo() and a little thought to help diagnose issues like this, and see the output in your openhab.log

if (Gang_Soll.state == Uninitialized) {
   // do stuff
} else {
   logInfo("test", "Unexpected state " + Gang_Soll.state.toString)
}

Thank you! Now it works :smile:

I had several Problems. It worked when changing the Gang_Soll.state == NULL. Also I was trying to convert a temperature Value to a Double via as DecimalType , it worked when using as QuantityType.

Wouldn’t it be better to configure a persistence service for this purpose?