Initialising items on startup

I have set a rule to set default value for two items but when I display it in log only one seems to display correctly , however displaying sitemap it seems both are correct.
is this the best practice for initializing values?

log: output

initialising Hotwater low temp:38.0, very low:NULL

water.rules

rule "hotwater initialise"
when
  System started 
then
  if (HotwaterMins.state == NULL) { HotwaterMins.postUpdate(60)   }
  if (HotwaterLow.state == NULL)  { 
	  HotwaterLow.postUpdate(38.0)  
	  HotwaterVeryLow.postUpdate(29.0)  
	  logInfo("hotwater", "initialising Hotwater low temp:" + HotwaterLow.state + ", very low:" + HotwaterVeryLow.state )
	  }
  
end

postUpdate only puts the update onto openHAB’s internal event bus. It gets actioned a little while.later.
That to say, if you issue postUpdate in a rule it does not stop and wait for the update to be carried out.

ok asynchronous update… ok good to know.

1 Like