HomeGenie Forum

Automation Program Plugins and Wizard Scripting => APP Contributions => Topic started by: saue0 on August 18, 2015, 06:58:37 PM

Title: Philips Hue Remake
Post by: saue0 on August 18, 2015, 06:58:37 PM
Hi All,

I am new to HG, and Love It.
Here is a remake for the Philips Hue.

It autocreate the module for the Light and the Groups.
It may be a litle bugged.

Please Give me somme feedback.

Thanks

Edit: New version ....
Title: Re: Philips Hue Remake
Post by: ebasta on September 06, 2015, 03:53:21 AM
I am getting this error:

Runtime.Error = "CR: Invalid format."
Title: Re: Philips Hue Remake
Post by: saue0 on September 08, 2015, 06:58:36 PM
Can you gime me the moment at witch your getting this error ?

- On startup of the script (Creation of the virtual module)
- Every 10 second   (Refresh loop)
- On sending a command ?

This will help me finding the problem.

I have a system with 6 light (3 Hue and 3 Hue Lux)
and have 3 Groups.
Title: Re: Philips Hue Remake
Post by: Gene on September 08, 2015, 07:41:47 PM
Quote
Runtime.Error = "CR: Invalid format."

just guessing: perhaps different firmware version could give different output from what the app is expecting.

g.
Title: Re: Philips Hue Remake
Post by: ebasta on September 09, 2015, 02:14:58 AM
It happens as soon as I try to activate the program.  If fails loading and gives the error. I cannot load the program at all. I have updated the hub to the latest Philips pushed firmware - if that helps.

Title: Re: Philips Hue Remake
Post by: saue0 on September 09, 2015, 07:08:11 PM
Here is a new version with some log info.
please retry it and attach the log file.
Title: Re: Philips Hue Remake
Post by: ebasta on September 09, 2015, 08:05:22 PM
Attached is the recent part of the log where I attempted to run.  I hope this helps.
Title: Re: Philips Hue Remake
Post by: saue0 on September 09, 2015, 09:04:38 PM
Have you setup your bridge IP and User ?
The first thing i do is call the brigde to get the light config. and it seem not to be done

Why is this line not complete in the log ?
"2015-09-09T17:57:39.5577150+00:00   HomeAutomation.HomeGenie.Automation   1000   Automation Program   Program.Notification   {""Title"":""MyPhilipsHue """

It is missing "API Call"  [ Program.Notify("MyPhilipsHue ", "API Call"); ]
Title: Re: Philips Hue Remake
Post by: ebasta on September 09, 2015, 10:01:05 PM
Yes - I've set up and tested (via the api) the validity of the user and the IP.  All seems to be good.   I don't know why that part of the log is truncated.  I'll delete and reinstall and try again.
Title: Re: Philips Hue Remake
Post by: saue0 on September 10, 2015, 03:09:55 AM
I did a change, pleare retry

I also included an exemple of ly log file.
Title: Re: Philips Hue Remake
Post by: saue0 on September 12, 2015, 06:15:31 AM
Problem solve,
  I reinstall on a new PI 2 and I had the same problem.
     Level and ColorHSB were not initialise on the first creation of the virtual module.

On my window system, the VM where there with valid data. so no bug.

Please retry , and use the new widget as well
Title: Re: Philips Hue Remake
Post by: gustavo on September 15, 2015, 09:20:37 PM
saue0,

Very cool module.  After your latest update, I'm not seeing the runtime errors either.

It looks like you have code to tell different light types?  E.g. it looks like it can tell the difference between my hue color, and my non-color lights (I'm using GE Link bulbs, but I think for all intents and purposes they are identical to luxe).

It appears, however, that my Hue Bloom bulbs are being detected as non-color bulbs ?

------------ EDIT -----------------
Looking here:

        if (ltype.Equals("Extended color light"))
            Program.AddVirtualModule(MODULES_DOMAIN, idx.ToString(), "Dimmer", MODULES_WIDGET);

Philips Hue Bloom: "Color light"
GE Link Bulbs: "Dimmable light"
Philips Hue Bulb: "Extended color light"

So I think the if state should be:
if ((ltype.Equals("Color light")) || (ltype.Equals("Extended color light")))

Title: Re: Philips Hue Remake
Post by: ebasta on September 17, 2015, 06:43:41 AM
The runtime errors are gone - however I cannot get a color selector on android client
Title: Re: Philips Hue Remake
Post by: saue0 on September 17, 2015, 03:10:44 PM
gustavo, yes this is correck to support the other type.
I only have 2 types at the moment. If you know other type, i will add them as well,
Or is there an oderway of finding out if the light support colors ?

ebasta, change this line in the code ,
const string MODULES_WIDGET = "erx/philips/hue";
To "homegenie/generic/colorlight";
This will replace the widget with te original one, but you will loose the new buttons.

The android application do not know wat to do whit my widget.
Title: Re: Philips Hue Remake
Post by: saue0 on September 18, 2015, 02:27:37 PM
I Have a small question, 

Is the widget stats save somewhere ?
Because when a restart the software, some widget do not keep the last state they had
 
Title: Re: Philips Hue Remake
Post by: bkenobi on September 19, 2015, 05:52:45 PM
I believe all modules are initially off when you start up HG.
Title: Re: Philips Hue Remake
Post by: gustavo on September 19, 2015, 10:05:42 PM
gustavo, yes this is correck to support the other type.
I only have 2 types at the moment. If you know other type, i will add them as well,
Or is there an oderway of finding out if the light support colors ?

The only other one I know of is "Color light" which is the bloom.  I have all three types at my house - bloom, regular hue bulbs, and non-color hue bulbs (both the $12 GE Links and the $20 hue lux's).  Your code works perfect with all of them when the single line fix I earlier suggested.  E.g. if it's a Color light or Extended color light, treat it one way, otherwise treat it as a non-color light.

Thanks,
Gus
Title: Re: Philips Hue Remake
Post by: ebasta on September 23, 2015, 12:03:17 AM
ebasta, change this line in the code ,
const string MODULES_WIDGET = "erx/philips/hue";
To "homegenie/generic/colorlight";
This will replace the widget with te original one, but you will loose the new buttons.

The android application do not know wat to do whit my widget.

Totally worked - thank you!!