In the ON and OFF script of a unit a call to the value verb will return the current value of the unit, not the new value being set. In order to see what the future value of the unit will be you need to use the Future Value verb.
returns a real number that will be the value of unit after the new command is received.
if (future value) > 300 then write log “Error in reading, setting to current value” color red change future value to (value of (thisUnit)) else write log “Reading Appears Valid, continue" end if
Using with Enumerated Values:
For Units with Enumerated Values you can use the optional “for” parameter to the enumerated value verb to get the enumeration for the future value. Without the “for“ parameter it will return the enumeration for the current value and not the new value. By passing the future value, or any number within range, the correct enumeration can be read.
write log “new enumerated value will be “ & (enumerated value for (futureValue))