User Tools

Site Tools


Sidebar

dictionary:unitinformation:setvalueof

Set Value Of

Set the value of a unit as a counter.

Usage:

set value of (name of pseudo unit)

Optional Parameters:

  • to (number, any real number. 10, 4.5, 0.567, -5.23)
  • 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)
  • in (integer, seconds, ie: 30, 30 * minutes, 2 * hours, 7 * days) creates a scheduled event to perform the set value in this amount of time
  • for (integer, seconds, ie: 30, 30 * minutes, 2 * hours, 7 * days) creates a scheduled event to return the unit to it’s current value after this amount of time. If the in parameter is specified then this event will be after that interval.
  • at (date) Like the in parameter, creates a Scheduled Event to set the value at the specified AppleScript date.
  • until (date) Like the for parameter, creates a Scheduled Event to return the value to the current value at the specified AppleScript date.
  • timestamp (date) Instead of updating the timestamp of the unit to the current date it will set it to the timestamp passed here. If you are receiving data from some external source that includes a timestamp that might not be right now use this to override that and display the correct time. You can also use this to preserve timestamps when rolling today/yesterday type pseudos. See example below. Keep in mind that for data stored in XTdb new records must always be after previous records. It will honor the timestamp unless that would put the new record before a previous record in which case it will ignore it.

Examples:

--increment a counter
set value of "Inside Motion Count" by 1
 
set value of “overhead light” to 50 in 10 * minutes for 30 * minutes
 
-- and an example preserving the timestamp 
 
set value of “yesterdays low temp” to (value of “todays low temp”) timestamp (timestamp of “todays low temp”)

Notes:

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 dim/bright commands, but the values are limited to integers between 0 and 100 in that case.

dictionary/unitinformation/setvalueof.txt · Last modified: 2017/10/15 16:06 by James Sentman