Page 1 of 1

Hue Plugin & Python Scripting ?

PostPosted: Mon Aug 01, 2022 2:06 pm
by SearchCz
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?

Re: Hue Plugin & Python Scripting ?

PostPosted: Mon Aug 01, 2022 3:20 pm
by FlyingDiver
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})

Re: Hue Plugin & Python Scripting ?

PostPosted: Tue Aug 02, 2022 8:33 am
by SearchCz
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!