Changing the value of a custom device state using Python

Posted on
Tue Apr 02, 2019 9:46 am
indigobo offline
User avatar
Posts: 22
Joined: Jan 04, 2019
Location: Raleigh, NC

Changing the value of a custom device state using Python

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"

Posted on
Tue Apr 02, 2019 11:18 am
jay (support) offline
Site Admin
User avatar
Posts: 16817
Joined: Mar 19, 2008
Location: Austin, Texas

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

[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

Posted on
Wed Apr 03, 2019 7:15 am
indigobo offline
User avatar
Posts: 22
Joined: Jan 04, 2019
Location: Raleigh, NC

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

Thanks for pointing me in the right direction Jay!

Posted on
Tue Oct 15, 2019 9:04 pm
hamw offline
Posts: 1214
Joined: Mar 31, 2008

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

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?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest