I can’t figure out why the template node can’t getting entity_id value from the payload json.
This flow doesn’t turn the led strip on.
[{"id":"ce2fef5d.6a34b","type":"template","z":"ddb53db6.05ab8","name":"template msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{ \"data\": {\"entity_id\" : {{payload.data.entity_id}}, \"rgb_color\" : {{payload.data.rgb_color}} }}","output":"str","x":460,"y":380,"wires":[["46a8f029.afa14"]],"icon":"node-red-contrib-color-convert/color-convert.png"},{"id":"9cfc1327.74b41","type":"function","z":"ddb53db6.05ab8","name":"set rgb","func":"\nmsg.payload = {};\n\nmsg.payload.data = {};\nmsg.payload.data.entity_id=\"light.sylv_led_strip1\";\nmsg.payload.data.rgb_color = \"[128,243,32]\";\n\n\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":380,"wires":[["ce2fef5d.6a34b"]]},{"id":"46a8f029.afa14","type":"api-call-service","z":"ddb53db6.05ab8","name":"turn_on","server":"e8b4e59e.644ec8","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"","data":"{}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":620,"y":380,"wires":[[]]},{"id":"cd75bbd0.c45918","type":"inject","z":"ddb53db6.05ab8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":380,"wires":[["9cfc1327.74b41"]]},{"id":"e8b4e59e.644ec8","type":"server","z":"","name":"myHASS","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
However if I hardcode the entityid, it works: (note the template node still can get rgb color correctly)
[{"id":"6724f08.0cac41","type":"template","z":"ddb53db6.05ab8","name":"template msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{ \"data\": {\"entity_id\" : \"light.sylv_led_strip1\", \"rgb_color\" : {{payload.data.rgb_color}} }}","output":"str","x":460,"y":480,"wires":[["6a27fd04.fe7b24"]],"icon":"node-red-contrib-color-convert/color-convert.png"},{"id":"ee6197a1.3930c8","type":"function","z":"ddb53db6.05ab8","name":"set rgb","func":"\nmsg.payload = {};\n\nmsg.payload.data = {};\nmsg.payload.data.entity_id=\"light.sylv_led_strip1\";\nmsg.payload.data.rgb_color = \"[128,243,32]\";\n\n\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":480,"wires":[["6724f08.0cac41"]]},{"id":"6a27fd04.fe7b24","type":"api-call-service","z":"ddb53db6.05ab8","name":"turn_on","server":"e8b4e59e.644ec8","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"","data":"{}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":620,"y":480,"wires":[[]]},{"id":"d021a8a8.fedeb8","type":"inject","z":"ddb53db6.05ab8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":480,"wires":[["ee6197a1.3930c8"]]},{"id":"e8b4e59e.644ec8","type":"server","z":"","name":"myHASS","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
What did I miss?
Thanks