Hi all,
I’m trying to create a ‘clean’ process for configuring my lights.
To do this, i’m using NodeRed and would like to prepare all the ‘data’ (brightness, color, transition, etc) in a separate node and then send it to several ‘call service’ nodes to be able to easily apply the same dataset to several lights in a flexible way.
What I’ve tried is to use a ‘template’ node to compose the data and send it to ‘msg.payload.data’, but I didn’t yet succeed. Anyone who can help me to get this working?
A copy of the setup can be found below:
[
{
"id": "3c763b1c.fec884",
"type": "template",
"z": "5c6092e6.285e1c",
"name": "",
"field": "payload.Data",
"fieldType": "msg",
"format": "json",
"syntax": "plain",
"template": "{ \"transition\": 1, \"color_name\": \"magenta\", \"brightness_pct\": 100}",
"output": "json",
"x": 920,
"y": 240,
"wires": [
[
"1379c144.4f8bbf"
]
]
},
{
"id": "8ebe21dd.c2b22",
"type": "inject",
"z": "5c6092e6.285e1c",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 700,
"y": 240,
"wires": [
[
"3c763b1c.fec884"
]
]
},
{
"id": "1379c144.4f8bbf",
"type": "api-call-service",
"z": "5c6092e6.285e1c",
"name": "",
"server": "505f997a.bd0f78",
"version": 1,
"debugenabled": true,
"service_domain": "light",
"service": "turn_on",
"entityId": "light.hue04_light",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "payload",
"output_location_type": "msg",
"mustacheAltTags": false,
"x": 1150,
"y": 240,
"wires": [
[]
]
},
{
"id": "505f997a.bd0f78",
"type": "server",
"z": "",
"name": "Home Assistant",
"addon": true
}
]