User Tools

Site Tools


dictionary:unitinformation:queryof

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dictionary:unitinformation:queryof [2017/10/15 16:05] James Sentmandictionary:unitinformation:queryof [2023/02/13 14:52] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====Query==== ====Query====
  
-Send status request to a unit and receive status response.+If supported by the device being queried this will generate a request for the current value of the physical device. The value is not returned from verb but rather the script continues immediately after the command is sent. Depending on the settings of the specific interface and unit the value will be returned as if a change was received and the On or Off script will be run
  
-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:=== ===Usage:===
 **query** (unit name) **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:=== ===Examples:===
 <code applescript> <code applescript>
---did someone manually turn on that smart lamp unit? +query “a non reporting Z-Wave switch"
-if (query "My Lamp with Smart Module") is true then +
-  write log "hey, who turned on the lamp" +
-end if+
 </code> </code>
  
-<code applescript> 
---just update database if the state of the heater has changed 
-query "Smart Heater Module" with no wait 
-</code> 
  
 ===Notes:=== ===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 replyIf you reply is received the script will throw an error. You can test for the available of unit this way by checking for the error like this: +In very old versions of XTension the query verb was synchronous and would return the current value of the unit. While the scripting dictionary still shows such switches as “with no wait” and timeout function these are no longer supportedAll queries are asynchronous. The new value will be returned in the normal way as if new value had been received from the unit.
- +
-<code applescript> +
-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 +
-</code> +
  
dictionary/unitinformation/queryof.1508083544.txt.gz · Last modified: 2023/02/13 14:51 (external edit)