Hi,
I’m trying to use function node to make an entity_id list to be used in call service node but without success here is what I’m using:
[{"id":"4278b032e0ddcfec","type":"api-call-service","z":"d05daf04de9e815b","name":"reboot deco","server":"68c26a11.2f8a04","version":5,"debugenabled":true,"domain":"tplink_deco","service":"reboot_deco","areaId":[],"deviceId":[],"entityId":["{{payload.entity_id}}"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":450,"y":140,"wires":[[]]},{"id":"f0711a1e44ba92f1","type":"function","z":"d05daf04de9e815b","name":"","func":"if (msg.payload === \"test\") msg.payload = {\"entity_id\":\"device_tracker.roof_deco\"};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":140,"wires":[["4278b032e0ddcfec"]]},{"id":"4d3e31e8fdf7e08d","type":"inject","z":"d05daf04de9e815b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test","payloadType":"str","x":130,"y":140,"wires":[["f0711a1e44ba92f1"]]}]
the flow above get this error:
if I use this flow it works:
[{"id":"df962c72291077d9","type":"api-call-service","z":"b30b34f03c8840d2","name":"reboot deco","server":"68c26a11.2f8a04","version":5,"debugenabled":true,"domain":"tplink_deco","service":"reboot_deco","areaId":[],"deviceId":[],"entityId":["device_tracker.roof_deco","{{payload.entity_id}}"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":470,"y":120,"wires":[[]]},{"id":"3cd1ad0e2e7282be","type":"function","z":"b30b34f03c8840d2","name":"","func":"if (msg.payload === \"test\") msg.payload = {\"entity_id\":\"device_tracker.roof_deco\"};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":120,"wires":[["df962c72291077d9"]]},{"id":"1175e2e19e78eb62","type":"inject","z":"b30b34f03c8840d2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test","payloadType":"str","x":150,"y":120,"wires":[["3cd1ad0e2e7282be"]]}]
any help to make it work on the first code ?
thank you