# Node Red Loxone & Philips Hue Ambiance

**URL:** <https://discourse.nodered.org/t/node-red-loxone-philips-hue-ambiance/55617>\
**Category:** General\
**Created:** [23 December 2021 15:20 UTC](https://discourse.nodered.org/t/node-red-loxone-philips-hue-ambiance/55617 "2021-12-23T15:20:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liteworx](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@liteworx](https://discourse.nodered.org/u/liteworx)\
**Post date:** [23 December 2021 15:20 UTC](https://discourse.nodered.org/t/node-red-loxone-philips-hue-ambiance/55617/1 "2021-12-23T15:20:29Z")

</div>

## Node Red - Philips HUE Ambiance

vor 12 Minuten

I'm using the **[node-red-contrib-loxone 0.10.11](https://flows.nodered.org/node/node-red-contrib-loxone) along with the [node-red-contrib-huemagic (node)](https://flows.nodered.org/node/node-red-contrib-huemagic)**

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/](https://www.reddit.com/r/tasker/comments/4n47fk/setting_the_color_temperature_of_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 🙂

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [23 December 2021 15:39 UTC](https://discourse.nodered.org/t/node-red-loxone-philips-hue-ambiance/55617/2 "2021-12-23T15:39:55Z")

</div>

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):

```auto
input: string "temp(100,2700)"

```

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

```

Output:

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

```

Example flow.

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

**Author:** ![liteworx](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@liteworx](https://discourse.nodered.org/u/liteworx)\
**Post date:** [23 December 2021 15:56 UTC](https://discourse.nodered.org/t/node-red-loxone-philips-hue-ambiance/55617/3 "2021-12-23T15:56:15Z")

</div>

Thank you so much that worked perfectly

🙂 🙂 🙂 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 January 2022 15:56 UTC](https://discourse.nodered.org/t/node-red-loxone-philips-hue-ambiance/55617/4 "2022-01-06T15:56:32Z")

</div>

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