Hue Plugin & Python Scripting ?

Posted on
Mon Aug 01, 2022 2:06 pm
SearchCz offline
Posts: 122
Joined: Sep 18, 2019

Hue Plugin & Python Scripting ?

I'm trying an example directly off of the Hue Lights plugin support page. It goes like this:

Code: Select all
plug = indigo.server.getPlugin("com.nathansheldon.indigoplugin.HueLights")
if plug.isEnabled():

   # Set the red, green, and blue color values of the "Table Lamp" to 245, 18, and 150 (respectively).
   plug.executeAction("setRGB", indigo.devices[1649955594], props={"red":245, "green":18, "blue":150})


Is throwing a bunch of errors:

Code: Select all
   Script Error                    embedded script error:
   Script Error                    Python argument types in
    PluginInfo.executeAction(PluginInfo, str, DimmerDevice)
did not match C++ signature:
    executeAction(CPlugin {lvalue}, CCString actionTypeId, unsigned long deviceId=0, boost::python::api::object props=None, bool waitUntilDone=True)
   Script Error                    Exception Traceback (most recent call shown last):

     embedded script, line 5, at top level
ArgumentError: Python argument types in
    PluginInfo.executeAction(PluginInfo, str, DimmerDevice)
did not match C++ signature:
    executeAction(CPlugin {lvalue}, CCString actionTypeId, unsigned long deviceId=0, boost::python::api::object props=None, bool waitUntilDone=True)


Thoughts? I've got 18 lights and I want to be able to set them to whatever color I have in mind at the moment. I was hoping a python script would be an efficient way to get my desired RGB values at any given moment into all 18 lights.

Help?

Posted on
Mon Aug 01, 2022 3:20 pm
FlyingDiver offline
User avatar
Posts: 6193
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Hue Plugin & Python Scripting ?

executeAction expects the DeviceID, not the device. So:

Code: Select all
plug = indigo.server.getPlugin("com.nathansheldon.indigoplugin.HueLights")
if plug.isEnabled():

   # Set the red, green, and blue color values of the "Table Lamp" to 245, 18, and 150 (respectively).
   plug.executeAction("setRGB", deviceId=1649955594, props={"red":245, "green":18, "blue":150})

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 02, 2022 8:33 am
SearchCz offline
Posts: 122
Joined: Sep 18, 2019

Re: Hue Plugin & Python Scripting ?

FlyingDiver wrote:
executeAction expects the DeviceID, not the device. So:

Code: Select all
plug = indigo.server.getPlugin("com.nathansheldon.indigoplugin.HueLights")
if plug.isEnabled():

   # Set the red, green, and blue color values of the "Table Lamp" to 245, 18, and 150 (respectively).
   plug.executeAction("setRGB", deviceId=1649955594, props={"red":245, "green":18, "blue":150})


Yessir! That did the trick!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest