Page 1 of 1

Changing the value of a custom device state using Python

PostPosted: Tue Apr 02, 2019 9:46 am
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"

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

PostPosted: Tue Apr 02, 2019 11:18 am
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.

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

PostPosted: Wed Apr 03, 2019 7:15 am
by indigobo
Thanks for pointing me in the right direction Jay!

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

PostPosted: Tue Oct 15, 2019 9:04 pm
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?