Table of Contents
Change Future Value
In the ON script of a unit you can override the new future value by using this verb.
change future value to (number or enumeration string, will override the received value and set this instead)
You can pass a numerical value, or if there is a valid enumeration for the unit you can also pass a string that is one of the enumerations.
In this example we will filter out a bad value and keep the value of the Unit set to the current value until a valid reading comes in.
if (future value) > 300 then write log “bad value filtered" change future value to (value of (thisUnit)) end if
In this example the unit receiving a new value must be dimmable and have an enumeration string in the Display tab of the edit unit dialog. This example is non-sensical as I can’t imagine that you’d really want a Unit to do this, but it does illustrate using the enumeration string rather than a numerical value.
The Unit has an enumeration string of “off,low,medium,high” and this will reset the unit to always be “medium”. Note that if this unit is receiving a value from some other device, like a real ceiling fan or something just changing the future value will NOT send a new command to the real device setting it to the value different than what it just reported to you. This changes only what value XTension has in the database. If you want to conform a real device by sending a new command to it, you would use the regular set value command.
if (enumerated value) is not equal to “medium” then change future value to “medium" write log “value has been adjusted to medium" else write log “new value is already medium, no changes necessary" end if
used in the Smoothing An Input Tutorial.
The ability to pass an enumeration was added in XTension v9.5.3