Node Red Loxone & Philips Hue Ambiance

Node Red - Philips HUE Ambiance

vor 12 Minuten

I'm using the node-red-contrib-loxone 0.10.11 along with the node-red-contrib-huemagic (node)

to control HUE lamps from Loxone which works great when using Philips HUE RGB bulbs

But I've recently tried to control some Philips HUE Ambiance lamps (warm,natural,cool) lamps

I've setup my output of my Loxone lighting controller as RGB and when using the warm / natural / cool colour picker in the loxone app
I get the following information in node red:

Pendant : msg.payload : string[14]
"temp(100,2700)"

100 being the brightness - 2700 being the colour temperature

However the Philips Hue Ambianc lamps requires colour temperature in a different format:

on: true
brightness: 100
brightnessLevel: 254
reachable: true
colorTemp: 454

From what I have researched the Hue lamps require the colour temperature in Mired format

https://www.reddit.com/r/tasker/comm...a_philips_hue/

All we need to know is that M = 1000000 / T where M is Mired and T is the light temperature in degrees Kelvin.

So for our 2700K equivalent ct value we get:

M = 1000000 / 2700 M = 370.37037037

Does anyone have a flow they can share that will convert the Loxone values to the Philips HUE required values ?

Thanks in advance :slight_smile:

The format that you receive from the loxon needs to be parsed (if this is the actual format that you receive).
This can be done with a function node or with a change node in jsonata syntax (set msg.payload to jsonata):

input: string "temp(100,2700)"
(
    $c:= $match(payload,/\((\d+),(\d+)\)/).groups;
{
    "brightness":$number($c[0]),
    "colorTemp":$round(1000000/$number($c[1]),0)
})

Output:

{
  "brightness": 100,
  "colorTemp": 370
}

Example flow.

[{"id":"0fad9fb9a5973506","type":"inject","z":"7351324319c98582","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"temp(100,2700)","payloadType":"str","x":250,"y":300,"wires":[["b33b52d374958461"]]},{"id":"b33b52d374958461","type":"change","z":"7351324319c98582","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"( \t    $c:= $match(payload,/\\((\\d+),(\\d+)\\)/).groups; \t    {     \t        \"brightness\":$number($c[0]),\t        \"colorTemp\":$round(1000000/$number($c[1]),0) \t    }\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":300,"wires":[["5e5a58324f26fd0c"]]},{"id":"5e5a58324f26fd0c","type":"debug","z":"7351324319c98582","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":300,"wires":[]}]

Thank you so much that worked perfectly

:slightly_smiling_face: :slightly_smiling_face: :slightly_smiling_face: :slightly_smiling_face:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.