User Tools

Site Tools


xtdb:applescript:dutycycle

Table of Contents

Duty Cycle Of

Calculates the current duty cycle of any device with on/off cycles for the amount of time you specify. It is only possible to get data that ends in the current moment with this verb, not specific time frames in the past.

Usage:

  • Duty Cycle Of [text: name of the Unit or Database]
    • for [integer: the number of minutes to go back in time to start the calculation.]
  • returns: [real number: the percent of time during the request minutes of time that the device was not off or set to 0]

Examples:

Check to make sure the dehumidifier is not running too much in the last 24 hours.

  tell app “XTdb” to set theDutyCycle to duty cycle of “basement dehumidifier state” for 24 * hours
  
  if theDutyCycle is greater than 85 then
    display dialog “the dehumidifier is stuck on again!"
  end if
xtdb/applescript/dutycycle.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1