System started rule

Hello,

I have the following configured

rule "Set item values when system starts"

when
        System started
then
        if (Presence.state==NULL) Presence.sendCommand(ON)
        if (MainDoor.state == NULL) MainDoor.sendCommand(CLOSED)
        if (Hum_Threshold == NULL) Hum_Threshold.postUpdate(20)
end

Presence and MainDoor items are being set just fine but Hum_threshold item remains NULL
Here’s the item configuration

Number Hum_Threshold    "Humidity Threshold [%s]"

What am I doing wrong ?

Christos

You do check this item differently. Try to check the state for this one also.

Why don’t you use MapDB to save each item change and reset them all after restart?

When I change it manually following a restart of openhab, I see this

2017-06-25 12:52:25.079 [ItemCommandEvent          ] - Item 'Hum_Threshold' received command 10.0
2017-06-25 12:52:25.086 [ItemStateChangedEvent     ] - Hum_Threshold changed from NULL to 10.0

So the value initially is NULL

I am thinking of persistence at a later stage but for now this simple rule is enough for me

if (Hum_Threshold == NULL)

This should be
if (Hum_Threshold.state == NULL)

spot on! thanks