Philips Hue Brightness + Milight

Hello,

I'm a beginner and can't go on with a flow.
I have a Philips Hue motion detector, this should only start the flow at a certain brightness. In the current flow I have the following in it: Motion is detected, Payload is converted to "on" and passed to the Milight node. This works fine. But how do I do it, that it only starts at a certain brightness.
Thank you!

which node are you using? Is it node-red-contrib-milight ?
Look at node-red-contrib-milight (node) - Node-RED

at the bottom of the page

To do

  • Implement brightness controls

So you can't do it with that node but the good news is node-red-contrib-milight-2 (node) - Node-RED can change the brightness but only "up" & "down" the example flow shows you how.

Hi Ukmoose

How I adjust the brightness of Milight is known to me.
I would like to know how I do it, that Milight is only switched on at a certain room brightness by the motion detector.

Use the range-node to map the lux value to brightness (in reverse)

example:

[{"id":"9064f5f1.3b2978","type":"inject","z":"936a5246.6c62c8","name":"","topic":"","payload":"{\"lux\":275}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":225,"wires":[["81b93fa1.217bc8"]]},{"id":"c96928.9d30e6d8","type":"inject","z":"936a5246.6c62c8","name":"","topic":"","payload":"{\"lux\":100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":275,"wires":[["81b93fa1.217bc8"]]},{"id":"390859f1.64efb6","type":"range","z":"936a5246.6c62c8","minin":"300","maxin":"0","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload.lux","name":"Lux to brightness","x":540,"y":250,"wires":[["54e72e27.5d4008"]]},{"id":"42248f26.eab4c8","type":"debug","z":"936a5246.6c62c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":920,"y":250,"wires":[]},{"id":"81b93fa1.217bc8","type":"switch","z":"936a5246.6c62c8","name":"if lux < 300","property":"payload.lux","propertyType":"msg","rules":[{"t":"lt","v":"300","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":345,"y":250,"wires":[["390859f1.64efb6"]]},{"id":"d3cb66f4.bdb4f","type":"inject","z":"936a5246.6c62c8","name":"","topic":"","payload":"{\"lux\":500}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":175,"wires":[["81b93fa1.217bc8"]]},{"id":"13d6c535.e5f07b","type":"inject","z":"936a5246.6c62c8","name":"","topic":"","payload":"{\"lux\":24}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":325,"wires":[["81b93fa1.217bc8"]]},{"id":"384eda62.d8358e","type":"comment","z":"936a5246.6c62c8","name":"500 = no trigger","info":"","x":330,"y":175,"wires":[]},{"id":"54e72e27.5d4008","type":"change","z":"936a5246.6c62c8","name":"set to brightness","rules":[{"t":"set","p":"payload.brightness","pt":"msg","to":"payload.lux","tot":"msg"},{"t":"delete","p":"payload.lux","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":250,"wires":[["42248f26.eab4c8"]]}]

Hello,

I'm afraid I don't make my request clear enough, excuse me!

The Hue node is lowered, among other things, into the motion detector. This also measures the brightness in the room.

I would like to do the following: only when the measured room brightness falls below a certain value should the motion detector activate the Milight light. See Flow.

[{"id":"826140c1.c6bf1","type":"hue-motion","z":"ccfca32a.407998","name":"Hue motion sensor 1","bridge":"60e7883b.24136","sensorid":"22","x":340,"y":1600,"wires":[["65fb6890.32bbd8","2fe92609.902e3a"]]},{"id":"3d00a257.3fa23e","type":"hue-brightness","z":"ccfca32a.407998","name":"Hue ambient light sensor 1","bridge":"60e7883b.24136","sensorid":"14","x":310,"y":1700,"wires":[["2fe92609.902e3a"]]},{"id":"65fb6890.32bbd8","type":"function","z":"ccfca32a.407998","name":"on","func":"msg.payload=\"on\"\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":1600,"wires":[["2aa87247.d469ce","65a29f31.daaf4"]]},{"id":"2aa87247.d469ce","type":"MiLight","z":"ccfca32a.407998","name":"MiLight","bulbtype":"rgbw","zone":"2","ip":"192.168.1.55","broadcast":true,"x":1180,"y":1600,"wires":[]},{"id":"65a29f31.daaf4","type":"delay","z":"ccfca32a.407998","name":"Delay 40sec","pauseType":"delay","timeout":"40","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":810,"y":1660,"wires":[["f460d832.830ee8"]]},{"id":"f460d832.830ee8","type":"function","z":"ccfca32a.407998","name":"off","func":"msg.payload=\"off\"\nreturn msg;","outputs":1,"noerr":0,"x":970,"y":1660,"wires":[["2aa87247.d469ce"]]},{"id":"2fe92609.902e3a","type":"debug","z":"ccfca32a.407998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":820,"y":1800,"wires":[]},{"id":"60e7883b.24136","type":"hue-bridge","z":"","name":"Philips hue","bridge":"192.168.1.23","key":"xMZB1HEuhnGCIU9uK73ErUBe74Ado5BdQfoaICUZ","interval":"3000"}]

I hope it's understandable now! Unfortunately English is not my native language.

So use a switch node on the lux flow to set a context value to either True or False

Then on your motion sensor flow use a switch node that only passes on a message if the context value is True. Theres an example in the cookbook https://cookbook.nodered.org/basic/route-on-context

Unfortunately I don't get it, but I still don't understand how NR works.

My idea was with this flow: if the Hue motion detector triggers AND the brightness value = "dark", Milight should be switched on.
But the flow doesn't work like that, light always comes on - no matter which brightness value is returned.

Anyone have an idea? Thank you very much!

[{"id":"15c33cd9.020293","type":"hue-motion","z":"a33a61d0.e919b8","name":"Wohnzimmer","bridge":"60e7883b.24136","sensorid":"22","x":290,"y":160,"wires":[["f51b7d01.785538","54084140.996dd"]]},{"id":"178b644d.2f4694","type":"hue-brightness","z":"a33a61d0.e919b8","name":"Wohnzimmer","bridge":"60e7883b.24136","sensorid":"23","x":290,"y":300,"wires":[["f51b7d01.785538","54084140.996dd"]]},{"id":"e474e422.73afa","type":"function","z":"a33a61d0.e919b8","name":"on","func":"msg.payload=\"on\"\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":220,"wires":[["f3678518.d37638","1fd4b150.d956af"]]},{"id":"f3678518.d37638","type":"MiLight","z":"a33a61d0.e919b8","name":"MiLight","bulbtype":"rgbw","zone":"2","ip":"192.168.1.55","broadcast":true,"x":1280,"y":220,"wires":[]},{"id":"1fd4b150.d956af","type":"delay","z":"a33a61d0.e919b8","name":"Delay 5sec","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":950,"y":260,"wires":[["de288579.d67788"]]},{"id":"de288579.d67788","type":"function","z":"a33a61d0.e919b8","name":"off","func":"msg.payload=\"off\"\nreturn msg;","outputs":1,"noerr":0,"x":1110,"y":260,"wires":[["f3678518.d37638"]]},{"id":"54084140.996dd","type":"switch","z":"a33a61d0.e919b8","name":"","property":"payload.on","propertyType":"msg","rules":[{"t":"eq","v":"payload.motion.true","vt":"str"},{"t":"eq","v":"payload.dark.true","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":220,"wires":[["e474e422.73afa"],["e474e422.73afa"]]},{"id":"f51b7d01.785538","type":"debug","z":"a33a61d0.e919b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":360,"wires":[]},{"id":"60e7883b.24136","type":"hue-bridge","z":"","name":"Philips hue","bridge":"192.168.1.23","key":"xMZB1HEuhnGCIU9uK73ErUBe74Ado5BdQfoaICUZ","interval":"3000"}]

Import the flow I linked to and play with it.

It shows you one way of linking two different message streams so you can do the equivalent of an AND

Add additional debug nodes so you can see exactly what is happening

I did, and I don't understand it. Maybe I am just too old for that.
but get it without nodered too.

thanks for the help! all the best!