I have a flow where I turn on/off lights dependent on lux and movement, but I would like to control how brightness dependent on part of day (day, evening etc.) I have the part of day as a sensor (values “day”, “morning”, “evening” etc.), I would then like to map brightness 100 to “day” and 10 to “night” etc. I would like to use this flow on a lot of light entities, so I guess it should be a subflow. How/where do I declare the brightness settings individually?
you can set it in global context so it will be available in all flows of your node-red setup:
Thanks, I am still pretty new to Node-Red, but how do I then map part_of_day “day” to brightness “100”?
switch node allows you to chose different outcomes. if it is day, the message is routed to upper output, otherwise lower output. for example add a service call node at the end of upper output for light.turn_on with data {“brightness_pct”:100}
[{"id":"15532dec.3e8be2","type":"switch","z":"de9989cc.589d18","name":"switch","property":"part_of_the_day","propertyType":"global","rules":[{"t":"eq","v":"day","vt":"str"},{"t":"eq","v":"night","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":520,"wires":[["2ded71b1.2aecce"],["fb835133.51ad6"]]},{"id":"2ded71b1.2aecce","type":"api-call-service","z":"de9989cc.589d18","name":"100%","server":"e447d17a.16a64","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hallway","data":"{\"brightness_pct\":100}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":530,"y":500,"wires":[[]]},{"id":"fb835133.51ad6","type":"api-call-service","z":"de9989cc.589d18","name":"10%","server":"e447d17a.16a64","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hallway","data":"{\"brightness_pct\":100}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":530,"y":540,"wires":[[]]},{"id":"e447d17a.16a64","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]
Thanks for your reply, how do I handle it when each light that I would like to use the sub flow with gas different brightness settings? So for one light brightness night should be 20 and for another light 30?