Changing the value of a custom device state using Python

User avatar
indigobo
Posts: 22
Joined: Fri Jan 04, 2019 11:45 am
Location: Raleigh, NC

Changing the value of a custom device state using Python

Post by indigobo »

Hello,

I am trying to figure out how to change the value of a custom device's state using python. I am using the EPS Alarm Clock plugin and have created a custom device to trigger different actions. I would like to be able to programmatically change one of its custom states (durationMinutes) but having trouble figuring it out.

I'm this far along, but the below code tells me "device object has no attribute "isEnabled".

Please help!

Code: Select all

myVar = indigo.variables[132104315] # time alarm is set for
deviceId = indigo.devices[1587511492] # custom eps alarm clock device
plug = indigo.server.getPlugin('deviceId') # variable containing the number I want to replace the custom device prop with

   
if deviceId.isEnabled():
     plug.executeAction("epsalarmclock", myVar, props={"durationMinutes":'myVar'}) #gives object has no attribute "isEnabled"
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Changing the value of a custom device state using Python

Post by jay (support) »

[MODERATOR NOTE] moved to the Alarm Clock plugin developer's forum since scripting plugin actions is specific to the plugin's implementation. I can say that what you have above will definitely not work for a variety of reasons. Plugins have to define actions that will allow scripters to modify plugin device states and properties. I'm not sure what the actions are for this plugin, but you'll need those details in order to do it.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
indigobo
Posts: 22
Joined: Fri Jan 04, 2019 11:45 am
Location: Raleigh, NC

Re: Changing the value of a custom device state using Python

Post by indigobo »

Thanks for pointing me in the right direction Jay!
hamw
Posts: 1342
Joined: Mon Mar 31, 2008 7:45 pm

Re: Changing the value of a custom device state using Python

Post by hamw »

wondering if you have had any success with this. Also, I tried to set up the hours/minutes advance/decrease, and this does not seem to update the display.

I would like to be able to set up an alarm clock page using this plugin to trigger action groups at the appropriate time. Any advice?
Post Reply

Return to “Other Indigo Bits and Bytes”