Rookie question…
I have seen many different item configurations using “if” with or without .state:
if(SwitchBath == ON) {…
if(SwitchBath.state == ON
if(StringTemp == “25”) {
if(StringTemp.state == “25”) {
What is the proper syntax for the different item types (Switch, String, Number, …?)
Also, this is a nit but if guardmode_tmp is never reassigned a new value it should be a ‘val’, not a ‘var’. This isn’t the cause of your error but a good coding practice that will save you some heartache later on.
Whenever you want to read or use the “value” of an Item you always have to use .state. Sometimes, particularly with DateTime Items and Number Items you have to cast the State to a more specific state. For example, if you want to do math with a Number Item’s value you need to do "val Number myNum = MyNum.state as DecimalType.
BUT, you only have to do this when you are referencing Items. Not for locally defined vars ad vals.