Hue Plugin & Python Scripting ?

Plug-ins, scripts, and other software to improve your home automation experience.
SearchCz
Posts: 175
Joined: Wed Sep 18, 2019 4:45 am

Hue Plugin & Python Scripting ?

Post 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?
User avatar
FlyingDiver
Posts: 7285
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Hue Plugin & Python Scripting ?

Post 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})
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SearchCz
Posts: 175
Joined: Wed Sep 18, 2019 4:45 am

Re: Hue Plugin & Python Scripting ?

Post 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!
Post Reply

Return to “Nathan Sheldon Software”