User Tools

Site Tools


dictionary:unitinformation:setvalueof

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dictionary:unitinformation:setvalueof [2017/03/06 14:01] – external edit 127.0.0.1dictionary:unitinformation:setvalueof [2023/02/13 14:52] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====Set Value Of==== ====Set Value Of====
 +
 Set the value of a unit as a counter. Set the value of a unit as a counter.
  
Line 6: Line 7:
  
 ===Optional Parameters:=== ===Optional Parameters:===
-  * **to** (number, any real number. 10, 4.5, 0.567, -5.23)\\+  * **to** (number or string, any real number. 10, 4.5, 0.567, -5.23, or an enumerated string value “heat”, “cool”, “off”: see below)\\
   * **by** (number, any real number to add to existing value. 5, -45, 3.1415, -9.3)\\   * **by** (number, any real number to add to existing value. 5, -45, 3.1415, -9.3)\\
   * **with no script** (stops the executing of the script)\\   * **with no script** (stops the executing of the script)\\
Line 27: Line 28:
  
 </code> </code>
 +
 +Some units do not have values that are easily converted to numbers, the Mode setting of a Thermostat for example. If it would make more sense to use a string to describe the value you can do that using an enumerated string. The enumerations come from the “comma separated list for popup” field on the [[xtension_manual:editunitdisplay|Display tab of the Edit Unit Dialog]] The control type does not need to be set to popup but the values must be in that field. For this example the field would contain the string “Off,Heat,Cool,EM Heat” Previous to the ability to pass strings to the set value verb you would have had to remember that to set the mode to cool you would set the value of the unit to 2. You can now pass the string “cool” to the set value verb like this:
 +
 +<code applescript>
 +--examples using enumerated strings
 +
 +set value of “Thermostat Mode” to “cool”
 +
 +-- or
 +
 +set value of “Thermostate Mode” to “off”
 +</code>
 +
 +The comparisons are not case sensitive. If the string is not found in the list then the value of the unit will not be set and an error will be returned.
  
  
Line 32: Line 47:
 Setting the value to 0 will execute the OFF script, if any. Setting the value to a non-zero value will run the ON script if any.\\ Setting the value to 0 will execute the OFF script, if any. Setting the value to a non-zero value will run the ON script if any.\\
 \\ \\
-You can use this verb instead of the [[dictionary:unitcontrol:dim|dim/bright]] commands, but the values are limited to integers between 0 and 100 in that case.+You can use this verb instead of the [[dictionary:unitcontrol:dim|dim/bright]] commands. This verb does not limit the value to a maximum of 100% as the dim/bright commands do.\\ 
 + 
 +===History:=== 
 + 
 +  * The ability to pass an enumerated string to the set value verb was added in XTension version 9.4.36.
dictionary/unitinformation/setvalueof.1488808913.txt.gz · Last modified: 2023/02/13 14:51 (external edit)