Philips Hue plugin

Questions and comments specific to a particular plugin should go here.
Post Reply
Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Wed Apr 06, 2016 7:59 pm

Changelog wrote: 0.4.0 by Aquila 2016-04-06
- Plugin should now get button pushed event from all types of switches. (As requested by Windhowl.)
- Changes in light status NOT made by this plugin will trigger event: PhilipsHue.<light #>.changed
- createScene no longer requiers 3. string to be "<New Scene>" to create a NEW scene. 3. string still needs to be existing scene to override. (Thanks to yokel22)
- Fixed bug in error output in functions "isGroupOn", "getGroupStatusAsCommand" and "getStatus" when plugin set to print everything. (Thanks to yokel22)
Version 0.4.0 is now available. Main new function is events given by all switches and changes to lights made by other apps. As always keep sending bugreports and requests for new functions.

As always the new version is available in the first post. :)

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Wed Apr 06, 2016 8:01 pm

Windhowl wrote:Hi
First of all I want to say thank you for this awesome plugin. Because of you there are so many possibilities :)

Now to my request:

I just added a Philips Hue Dimmer to my setup and wanted to trigger events with the 4 different buttons. I see that Eventghost is aware of button presses but every button has the same event output if I don't miss anything.
So my feature request would be to make it possible to receive each single button as an event.

Is that possible?

Greets Windhowl
Try version 0.4.0, it should work. As mentioned, I don't have the dimmer but I think my change will do the trick. Please report back how it works. :)

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Wed Apr 06, 2016 9:05 pm

Wow that's awesome!
I will try out Thursday and report back!

Thanks for the great support :)

Greets

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Thu Apr 07, 2016 4:29 pm

As promised my report:

It's actually working perfectly fine :)
When i press button 1 i get button.pressed.1001 or so and 1003 when button is released
button 2 i get button.pressed.1001
...and so on
only problem i encountered was on longpress of button 2 or 3 sometimes i get button.pressed.2000 (button2) or button.pressed.2002 i think its heavily dependent on timing.

But for me thats fine i just put both events as a trigger.
Awesome work aquila ! :D

If u need some more infos from the dimmer then tell me ! i would like to help

Greets

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Thu Apr 07, 2016 7:21 pm

Windhowl wrote:As promised my report:

It's actually working perfectly fine :)
When i press button 1 i get button.pressed.1001 or so and 1003 when button is released
button 2 i get button.pressed.1001
...and so on
only problem i encountered was on longpress of button 2 or 3 sometimes i get button.pressed.2000 (button2) or button.pressed.2002 i think its heavily dependent on timing.

But for me thats fine i just put both events as a trigger.
Awesome work aquila ! :D

If u need some more infos from the dimmer then tell me ! i would like to help

Greets
Hmm, this might be because the plugin pulls info from Hue every 2 seconds. So you could get diffrent results based on where in the prosess the buttonpush is when the plugin pulls info. You might also get 2 events when you longpress (one of each type), but that would depend on timing. I can not change this because of limits in the Hue API.

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Thu Apr 07, 2016 8:14 pm

Yeah i see, but as said it doesnt matter as it does the job quite well. May i ask you another Question?

Do you know how to execute two commands in eventghost simultaneously? I do have some milight bulbs and i want them to turn on at the same time as my hue bulbs but as of now they blink on one at a time..

I couldnt find a solution to this till now.

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Thu Apr 14, 2016 12:50 pm

Windhowl wrote:Yeah i see, but as said it doesnt matter as it does the job quite well. May i ask you another Question?

Do you know how to execute two commands in eventghost simultaneously? I do have some milight bulbs and i want them to turn on at the same time as my hue bulbs but as of now they blink on one at a time..

I couldnt find a solution to this till now.
You have to use threads to do this. I have not implemented threads IN my plugin, but you could run commands in a separate thread.

The reason I have not used threads in Eventghost is the limit to the speed of commands in the Philips Hue Hub. The Hub easily gets flooded by too many commands.

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Sat Apr 30, 2016 6:35 pm

Hey Aquila
Windhowl here once again!
I've recently faced a problem with your plugin. If i set my dimmer in the app to do nothing on press so he doesnt interfere with eventghost i get the following error message:

Exception in thread Thread-5:
Traceback (most recent call last):
File "threading.pyc", line 532, in __bootstrap_inner
File "threading.pyc", line 484, in run
File "C:\Program Files (x86)\EventGhost\plugins\PhilipsHue\__init__.py", line 293, in catchEvents
for l in g1['lights']:
TypeError: list indices must be integers, not str

Can you maybe help me?

Greets Windhowl! :)

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Sat Apr 30, 2016 7:01 pm

I'm not able to recreate this error. The error seems to be linked to a you changing a group via the plugin. And this group does not exist anymore when the eventthread is run. Could you be more elaborate about what you do, so that I can recreate the error.

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Sat Apr 30, 2016 7:48 pm

okay, I manged to replicate the error by dimming a group and deleting within 2 seconds of the dim command.

I have made a testfix. Could you see if this fixes your problem?
__init__.py
Test version (0.4.0.1)
(120.44 KiB) Downloaded 139 times

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Sat Apr 30, 2016 9:45 pm

Hmm it seems like the error is gone now. I did a reset with my hue Bridge.
Now everything works fine with the plugin except that he keeps loosing the connection with the dimmer. I could barely turn the lights off and now no presses get recognized by the plugin.

In the app on the other side i can see that he recognizes the presses. When i fetch a new username from the bridge it is working again for some time till he looses connection again..
i gave the bridge a fixed ip so that cant be the problem i can as well control the lights all the time..

You know of a possibile problem here ?

Greets Windhowl

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Sat Apr 30, 2016 9:54 pm

Ok i implemented the new init and no problems so far but i will report back tomorrow as for long term stability. Normally i lost connection after a day or two.

And big thanks so far for your fast help.

Greets

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Tue May 10, 2016 4:03 pm

Hey back there!
sorry it took so long to report back.

I had no problem till today and that means the stability got much better.
But today my sensor again doesnt respond or at least the plugin doesnt fetch the input of it. So i tried wether the plugin itself would work to control light ... and yeah it still works so the connection to bridge is established for sure. i dont know how i can give you further help/information but i hope you can help out.

I appreciate your work very much keep on doing so ! :)

Greetings Windhowl

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Philips Hue plugin

Post by Aquila » Wed May 11, 2016 12:24 pm

Hmm, it seems like the eventthread dies/hangs somehow. Could you cut power to one of the lights and monitor if you get the *.unreachable event? It should come in about 30 seconds.

If you get the event, then the event thread is not dead. If you don't get the event, then the event thread is dead. Then we have to figure out how it died. :p

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Philips Hue plugin

Post by Windhowl » Wed May 11, 2016 4:55 pm

Okay i checked that and there was no such event. so it seems like the eventthread died. Maybe you need some background info? eventghost runs on a htpc 24/7 i never cut the power of the lights nor the router theyre connected with if that helps?

Greets

Post Reply