Checking statuses

Posted on
Fri Apr 23, 2004 10:52 pm
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

Checking statuses

When the house is idle (ie no activity after x minutes) I wanted to have a script to cycle through all the units and sent a status requests for the 2 way devices.

Is it safe to just cycle through them and let Indigo handle everything or do I need to put some sort of delay in to make sure the status delay are received before I send out the next request.

Posted on
Sat Apr 24, 2004 8:10 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Checking statuses

You should be able to just send the status requests to all of the devices back-to-back. Indigo automatically blocks the output queue after it sends a status request until either a status response is received, or a timeout happens (after a few seconds).

You can simulate the behavior you want by selecting all of the devices in the Main Window and pressing the "Get Status" button at the bottom of the window. This will send status requests to all the devices that have the "supports status request" setting checked.

Matt

Posted on
Sat Apr 24, 2004 8:12 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Checking statuses

This gives me a good idea. I should add an AppleScript verb (and an Action type) that sends a status request to all of the devices that support it. Opinions?

Matt

Posted on
Sat Apr 24, 2004 9:35 am
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

Re: Checking statuses

support wrote:
This gives me a good idea. I should add an AppleScript verb (and an Action type) that sends a status request to all of the devices that support it. Opinions?


That would make it easier then writing a script to do it :D

Posted on
Sat Apr 24, 2004 10:08 pm
Dano offline
Posts: 20
Joined: Feb 24, 2004
Location: Sterling Heights, MI

Re: Checking statuses

support wrote:
This gives me a good idea. I should add an AppleScript verb (and an Action type) that sends a status request to all of the devices that support it. Opinions?

Matt


Yes, please do. That way if Indigo and my devices get out of sync, I can run a routine to correct it. With the .7sec delay in the buffered repeater, I have seen up to 1.4 seconds more for a response and have had these queued commands collide because the timeout was not long enough (rarely). I'd like to see it adjustable in the settings.

I'd still like to see an Applescript verb for updating device statuses in Indigo without sending commands, for scene commands that I absolutely know have set a certain device to a certain condition, too. I know it's a horrible way of doing things, but it'd be handy until later days if adding it is a low-effort. If that status change is tied to commands at a level that it'd be hard to code I could do without.

-Dan

--
Dan Mowczan

Posted on
Thu Jun 03, 2004 11:06 pm
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

(No subject)

I was under the impression there was some sort of support to check the status of devices via applescript now. Doesn't look like it's there unless I missed it.

Posted on
Fri Jun 04, 2004 7:20 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

(No subject)

gregjsmith wrote:
I was under the impression there was some sort of support to check the status of devices via applescript now. Doesn't look like it's there unless I missed it.

You can use send x10 status request if you know the device's address. If you are creating a Trigger or Time/Date Action, then you can use an action step with a device action of statusRequest.

Both of these will send the X10 command to query the status from a 2-way module -- they don't themselves return the status of a device. But there is an attachment script included with Indigo in the disabled attachments folder, CheckStatus sample.scpt, that then shows how one could listen for the status response X10 command coming back from the module. It isn't exactly straightforward to accomplish, but it is possible.

Regards,
Matt

Posted on
Fri Jun 04, 2004 7:43 am
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

(No subject)

All I want to do is make sure Indigo is up to date with the units state. I will check it out.

Posted on
Fri Jun 04, 2004 7:53 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

(No subject)

gregjsmith wrote:
All I want to do is make sure Indigo is up to date with the units state. I will check it out.

For this, you should try looping through all of the devices, see if the device type is one you are interested in (it supports status request), then send that device's address a status request.

I should add a "supports status request" property to the device. For now you'll have to look at the type and see if it is one you think supports a status request.

Matt

Posted on
Fri Jun 04, 2004 8:36 am
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

(No subject)

I assume that if the device doesn't support the status request Indigo just times out? If so what is that timeout value?

Posted on
Fri Jun 04, 2004 8:50 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

(No subject)

Correct. It times out after 5 seconds. During this time, all X10 command output is blocked. Once it times out, the queued up commands are sent.

Matt

Posted on
Fri Jun 04, 2004 8:19 pm
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

(No subject)

Here's the work around script I'm using until Matt can add those capabilities.

--[url=applescript://com.apple.scripteditor/?action=new&script=on%20UpdateDeviceStatus()%0A%09tell%20application%20%22Indigo%22%0A%09%09set%20n%20to%200%0A%09%09repeat%20with%20theDevice%20in%20devices%0A%09%09%09set%20n%20to%20n%20+%201%0A%09%09%09if%20((type%20of%20device%20n%20of%20devices)%20contains%20%222-way%22)%20or%20(type%20of%20device%20n%20of%20devices%20contains%20%222-Way%22)%20then%0A%09%09%09%09send%20x10%20status%20request%20to%20address%20(address%20of%20device%20n%20of%20devices)%20as%20string%0A%09%09%09%09delay%205%0A%09%09%09end%20if%0A%09%09end%20repeat%0A%09end%20tell%0Aend%20UpdateDeviceStatus]Click here to open this script in a new Script Editor window[/url].

on UpdateDeviceStatus()
     tell application "Indigo"
          set n to 0
          repeat with theDevice in devices
               set n to n + 1
               if ((type of device n of devices) contains "2-way") or (type of device n of devices contains "2-Way") then
                    send x10 status request to address (address of device n of devices) as string
                    delay 5
               end if
          end repeat
     end tell
end UpdateDeviceStatus


-------------------------
[This script was automatically tagged for color coded syntax by Script to Markup Code]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 32 guests