Author Topic: Philips Hue plugin by MiOS (BETA)  (Read 54789 times)

Offline RitterIwan

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: Philips Hue plugin by MiOS (BETA)
« Reply #330 on: August 28, 2017, 11:28:23 am »
Now that IKEA has updated Tradfri, I have connected Tradfri bulbs to the Hue gateway and it is all working fine. However these bulbs do not show up in Vera.
Will this always be the case or is this something that can be done at the plugin end?

I was digging a little bit deeper into the lua-code of the HUE plugin. The code asks for the manufacturer and for the specific type of the bulbs. As long the code won't be changed in the plugin, the IKEA bulbs won't show up.

Offline Hokum

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Philips Hue plugin by MiOS (BETA)
« Reply #331 on: August 28, 2017, 01:45:45 pm »
@cw-kid Atm you need the Tradfri hub (and a controller to add bulbs) in order to update the firmware of the bulbs. At least for now untill new stock has the updated firmware already installed.
Also I might add the firmware does not make the bulbs HomeKit enabled, they do not show up there either, but Ikea says this will come in the fall with another firmware update.

Offline hmspain

  • Hero Member
  • *****
  • Posts: 516
  • Karma: +16/-8
Re: Philips Hue plugin by MiOS (BETA)
« Reply #332 on: August 31, 2017, 09:56:25 pm »
Does the new Hue plugin support Hue motion sensors?

I ask because I think the Hue motion sensor is a potential game changer.  I tried every motion sensor I can find.  Some work poorly, some eat batteries, none are what I would call "ready for prime time".

In parallel with my current choice, the 4-in-one Aeotec motion sensors, are my Hue motion sensors.

The Aeotec 4-in-1s turn on what the Hue motion sensors cannot; that is fans for the most part.  I walk into the room and the lights come on just as designed.  The fans are not quite as responsive.

The battery life on the Hue motion sensors appears to be really, really good.  It might be polling, or superior design, but *I think* they have potential, and I'm dying to try them out on things other than Hue bulbs/strips/blooms.
« Last Edit: September 01, 2017, 09:27:43 am by hmspain »
VeraPlus (1); Cameras (6), Sirens (2), Hue Bulbs/Strips/Blooms (42), Fan Dimmer (6), Aeon 4-in-1s (10), Water Sensors (3), Z-Wave Switches (20), Nest Smoke/CO Protects (5), Nest Thermostat Gen3 (1), HEM Gen2s (2)

Offline martynwendon

  • Jr. Member
  • **
  • Posts: 84
  • Karma: +11/-1
Re: Philips Hue plugin by MiOS (BETA)
« Reply #333 on: September 06, 2017, 06:49:06 am »
Have to say this plugin (current stable 1.28) could do with a full rewrite as it's showing its age now .... coding "evolution" is probably the best way to describe it  ;D

Maybe this is already being handled internally @ Vera as I've not looked at any later beta?

Anyway, I patched 1.28 to add support for Innr devices BY 165, RS 125, RB 185 C and ST 110.  It should work with others too but I've not got any others to test with.


No support, use at your own risk etc, but works well enough for me both from the web UI and from Scenes ;D

L_PhilipsHue2_lua_PATCH_FOR_INNR.txt = standard merge file
L_PhilipsHue2.lua = modified 1.28 LUA file


Offline cw-kid

  • Hero Member
  • *****
  • Posts: 1238
  • Karma: +6/-2
    • Phaze1 Digital
Re: Philips Hue plugin by MiOS (BETA)
« Reply #334 on: September 11, 2017, 11:05:36 am »
I've finally figured out how to pick the HEX colors I want to work on the Hue Lights.

The Philips Hue plugin either in the Scenes Advanced editor or using a JSON http command seems to want the values of "hue" and "saturation". My problem was I couldn't figure out how to get a required hue value ranging in between (0 to 65535) from my original hex color code?

This comment I found on a forum pointed me in the right direction:

"First you have to convert the RGB value to TSL value, there is a lot of conversions functions in many languages. Then you send the TSL values to your lights with the attributes "hue", "sat" and "bri".

Note 1 : Some languages returns an angle for the hue value (0 - 360), you'll have to convert it in a uint16 value (0 to 65535). Just multiply by 182.

Note 2 : Some languages returns saturation and brigthness value as a percentage (0 - 100), you'll have to convert it in a uint8 value (0 - 254). Just multiply by 2.54"


TSL seems to be the same as HSL

Some examples:

RED

HEX Value = #FF0000
HSL Value = (0, 100%, 50%)

To calculate the Hue value to be in the range of (0 to 65535)

0 x 182 = 182

GREEN

HEX Value = #00FF00
HSL Value = (120, 100%, 50%)

To calculate the Hue value to be in the range of (0 to 65535)

120 x 182 = 21840

BLUE

HEX Value = #0000FF
HSL Value = (240, 100%, 50%)

To calculate the Hue value to be in the range of (0 to 65535)

240 x 182 = 43680

Initially I used this website here to convert HEX to HSL for the primary colors.

But now I can use a colour picker to get the HEX code or in fact just get the HSL numbers and times the HSL Hue number by 182 and use that number in my Vera scenes or LUA code and that is the colour that is then displayed on the Hue light(s).

I then used this website here and the color picker on there.

Pick any color you want, make a note of the HSL hue value and times it by 182, to give you the hue number ranging from 0 to 65535 which can then be used in Vera.

To get that Turquoise blue color in the attached screen shot it was: h = 172 x 182 gave me a number of 31304

Put that in a URL to test and the light changes to that color !

Code: [Select]
http://192.168.1.100:3480/data_request?id=lu_action&DeviceNum=193&serviceId=urn:micasaverde-com:serviceId:PhilipsHue1&action=SetHueAndSaturation&Hue=31304&Saturation=254
The device number "193" is the device ID number of my Philips Hue light strip in Vera, I wanted to control. The Saturation value I just left as "254" each time. Perhaps I also need to be changing the saturation value as well? by timing the HSL saturation percentage value by 2.54.

The main reason I wanted to do this was to try and match up the Fibaro RGBW controller which uses HEX color codes in Vera and the Philips Hue Light to be the same color initiated from a Vera scene etc. I am yet to test that though, but assume it will work and they will be the same color hopefully. But still being able to specify exact colors with hue value numbers, in your Vera scenes for a Philips Hue light is something I have never been able to do before.

« Last Edit: September 11, 2017, 04:15:21 pm by cw-kid »

Offline cw-kid

  • Hero Member
  • *****
  • Posts: 1238
  • Karma: +6/-2
    • Phaze1 Digital
Re: Philips Hue plugin by MiOS (BETA)
« Reply #335 on: September 11, 2017, 11:50:20 am »
So I just created my first new Vera scene called "Hue Blue"

I added two "Philips Hue" lights in to the scene, my TV LED backlights and some LED cabinet lights.

Actually the TV backlights are regular SMD 5050 RGB LED strip connected to a Dresden FLS-PP IP ballast. This makes them Zigbee Light Link / Philips Hue compatible etc.

The second light I added to the scene is an actual Philips Hue gen1 2m LED light strip, that is behind the cabinet below the wall mounted TV.

I also had to enter a value in to the Transitiontime field or the scene wouldn't work. See attached screen shot.

When I run this scene both LED strip lights turn blue. However they are not the same color blue, the Dresden linked ones look correct and are just BLUE the Philips gen1 LED strip however is a lighter shade of blue.

So this isn't so good if different lights are still going to be slightly different colors.  :(

EDIT: Created a second scene for RED and that works both LED light strips look the same shade of red.

EDIT2: Added a scene for GREEN and the Philips Hue gen1 LED strip is a lighter shade of green than the other Dresden linked LEDs.
« Last Edit: September 11, 2017, 04:30:15 pm by cw-kid »

Offline cw-kid

  • Hero Member
  • *****
  • Posts: 1238
  • Karma: +6/-2
    • Phaze1 Digital
Re: Philips Hue plugin by MiOS (BETA)
« Reply #336 on: September 11, 2017, 12:59:03 pm »
OK I have the three primary colors matching up on both LED strips now.

To do this I used the Color Wheel in the Imperihome app and manually adjusted the Philips Hue gen1 LED strip until by eye it matched the color shade of the other Dresden linked LED strip.

I then used the Philips Hue API Clip Debug page to GET the current hue value of the gen1 LED strip. I then adjusted my Vera scenes and entered the new hue value in for the gen1 strip light.

Now when I run the Red/Green/Blue scenes the two different LED strips look to be the same color etc.

I think if both the lights were exactly the same type i.e. if I had 2x gen1 LED strips then the colors would have been the same right away with out issue.

But it seems different types of lights might need some slight adjustment to look the same shade of color to the eye etc.

As an example of the difference in the hue numbers for a "matching" blue shade.

Dresden linked 5050 SMD RGB LED strip: Hue = 43680 Saturation = 254
Philips Hue gen1 LED strip:                     Hue =  47104 Saturation = 254