openHAB 5.1 SNAPSHOT Discussion

 if (typeof timer === 'number')

I have a js rule which works in 5.0 milestone but not in 5.1 snapshot 4801

“typeof timer” returns “true” in OH 5.0 milestone , but in OH 5.1 Snap 4801 it returns “undefined”.

Any ideas what has changed.

regards Wolf

if (event.itemState.toString() == 'offen' ){         // Wohnungstür öffnet

  items.TS03_OpenTimestamp.postUpdate(Date.now());  // Datum in Timestamp speichern
 
  //Meldung falls man abwesend ist
  if (iJemandAnwesend.state === 'OFF') OH_function.sendMessage(message_2);
  else {
    // Meldung falls anwesend und Haustür zu lange auf ist
    var timer = setTimeout(function() {OH_function.sendMessage(message_3)},1 * minute );   

    //Meldung falls anwesend und Toilettenfenster offen ist
    if (iFenster.state === 'offen') OH_function.sendMessage(message_1);
  }  
} else{          //Tür schliesst

  if (typeof timer === 'number') {
    clearTimeout (timer);
    timer = undefined ;
  }  
 items.TS03_CloseTimestamp.postUpdate(Date.now());  // Datum in Timestamp speichern
}