Applescript - Meta Device State

Posted on
Tue Dec 24, 2013 7:36 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Applescript - Meta Device State

I need to test for the on state of some Meta devices I have setup in an Applescript.
I seem to remember that it isn't possible for some reason with Meta devices?

Maybe this has been addressed or it may be possible using Python?

Here's what I've been trying.

Code: Select all
if the on state of device "Meta Security Kitchen Window" = "true" then
   enable time date action "Security Glow Flash Kitchen Window"
end if


Thanks,

Carl

Posted on
Wed Dec 25, 2013 3:47 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Applescript - Meta Device State

Been looking everywhere but can't seem to find an example of a Python script to
enable/disable a schedule.

Something like this I assume.

Code: Select all
dev = indigo.devices["Meta Security Kitchen Window"]
if dev.onState:
     indigo.schedule.enable ("Security Glow Flash Kitchen Window")



Any examples greatly appreciated!

Thanks, and Happy Holidays!

Carl

Posted on
Thu Dec 26, 2013 11:38 am
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

Re: Applescript - Meta Device State

Hi Carl,

Close -- presuming you want the enable/disable to mirror the device state try:

Code: Select all
dev = indigo.devices["Meta Security Kitchen Window"]
if dev.onState:
     indigo.schedule.enable ("Security Glow Flash Kitchen Window", dev.onState)

Image

Posted on
Thu Dec 26, 2013 1:10 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Applescript - Meta Device State

Thanks, it works to enable but it says disable isn't allowed.

Maybe called something else?

Carl

Posted on
Thu Dec 26, 2013 1:15 pm
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

Re: Applescript - Meta Device State

There is no disable method; you disable via the second argument. My example above should do both.

Image

Posted on
Thu Dec 26, 2013 1:30 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Applescript - Meta Device State

Sorry, a bit confused. So the same script should disable the schedule if the device is off?
Tried that and some other variations but can't find the right syntax.

Thanks,

Carl

Posted on
Thu Dec 26, 2013 4:55 pm
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

Re: Applescript - Meta Device State

My script example was wrong in that you need to remove the conditional so that the enable() line is always executed. The 2nd argument to the enable() function specifies if the schedule should be enabled or not (disabled).

Image

Posted on
Fri Dec 27, 2013 5:52 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Applescript - Meta Device State

Thanks Matt. Couldn't get it to work for the disable but it turns out to be just
as easy to use a simple disable schedule action.

Carl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest