Query

Send a status request to a unit and receive status response.

Some “smart” X10 units and all UPB units will allow you to query them for their local status. If the device supports it and replies within the timeout this command will return the value or status of the unit.

Usage:

query (unit name)

Optional Parameters:

with no wait (returns immediately to the script without the data, but when the device responds the database will be updated and any ON/OFF scripts will be run then in response to the update.

Examples:

--did someone manually turn on that smart lamp unit?
if (query "My Lamp with Smart Module") is true then
  write log "hey, who turned on the lamp"
end if
--just update database if the state of the heater has changed
query "Smart Heater Module" with no wait

Notes:

If you try to query a non-smart X10 unit or a non-UPB unit it will hold the script for up to 30 seconds waiting for a reply. If you reply is received the script will throw an error. You can test for the available of a unit this way by checking for the error like this:

try
  query "MyUnit on a breaker that often blows randomly"
  write log "unit responded, power must be on"
on error
  write log "unit failed to respond, check breakers!"
end try
dictionary/unitinformation/queryof.txt · Last modified: 2009/09/27 15:27 by James Sentman
CC Attribution-No Derivative Works 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0