dictionary:unitinformation:changefuturevalue
Differences
This shows you the differences between two versions of the page.
dictionary:unitinformation:changefuturevalue [2023/02/13 14:52] – created - external edit 127.0.0.1 | dictionary:unitinformation:changefuturevalue [2023/05/20 16:34] (current) – Added info about using an enumeration here James Sentman | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====Change Future Value==== | + | =====Change Future Value===== |
In the ON script of a unit you can override the new [[futurevalue|future value]] by using this verb. | In the ON script of a unit you can override the new [[futurevalue|future value]] by using this verb. | ||
- | ===Usage: | + | ====Usage:==== |
- | **change future value to** (number, will override the received value and set this instead | + | **change future value to** (number |
- | ===Notes: | + | 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. |
+ | |||
+ | ====Examples: | ||
+ | |||
+ | 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, | ||
+ | |||
+ | < | ||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====Notes:==== | ||
used in the [[: | used in the [[: | ||
+ | |||
+ | The ability to pass an enumeration was added in XTension v9.5.3 |
dictionary/unitinformation/changefuturevalue.1676299926.txt.gz · Last modified: 2023/02/13 14:52 by 127.0.0.1