Hi All, I have an issue with the new and supposed improved Action node in NodeRed. Up till a few weeks ago, I was using the old Call Service Node which I believe has been deprecated, but this has left many of my automations broken.
Basically, I was using function nodes to populate fields in the call service node, something that the documentation for the action node say’s is still possible as long as you ensure that the ‘Block input overrides’ is turned off (Unchecked).
The first problem I had was, that is you leave the action field empty, when the flow is run, an error is shown on the action none saying ‘ValidationError: “action” is not allowed to be empty’. I get a similar error when I leave the device/entity field empty, ‘HomeAssistantError: must contain at least one of entity_id, device_id, area_id, floor_id, label_id.’.
After further reading of the documentation, it basically say’s fill with something, and the input values will override the existing values.
Rather than bore you with more details, here are two examples of what is happening.
Example 1 using a function node
[{“id”:“da6f835974f882e4”,“type”:“group”,“z”:“cdd1f3af1e96317f”,“name”:“Test 1”,“style”:{“label”:true},“nodes”:[“ed2b7f0f042ba8b0”,“843d5c66beb3753f”,“bed13b9a501f5406”,“5a07c720fd7d25c0”,“584c3231cabb0494”],“x”:234,“y”:419,“w”:1052,“h”:182},{“id”:“ed2b7f0f042ba8b0”,“type”:“function”,“z”:“cdd1f3af1e96317f”,“g”:“da6f835974f882e4”,“name”:“function 5”,“func”:“\nif (msg.payload === "on") msg = {"action": "light.turn_on",\n "target": {\n "entity_id": ["light.lr_desk_spot_light"]\n },\n "data": {\n "color_name": "yellow",\n "brightness_pct": 90\n },\n}\nif (msg.payload === "off")\n msg = {"action": "light.turn_off",\n };\nreturn msg;”,“outputs”:1,“timeout”:0,“noerr”:0,“initialize”:“”,“finalize”:“”,“libs”:,“x”:640,“y”:520,“wires”:[[“843d5c66beb3753f”,“bed13b9a501f5406”]]},{“id”:“843d5c66beb3753f”,“type”:“debug”,“z”:“cdd1f3af1e96317f”,“g”:“da6f835974f882e4”,“name”:“debug 2”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“statusVal”:“”,“statusType”:“auto”,“x”:1180,“y”:540,“wires”:},{“id”:“bed13b9a501f5406”,“type”:“api-call-service”,“z”:“cdd1f3af1e96317f”,“g”:“da6f835974f882e4”,“name”:“Test”,“server”:“49f73a6c.255cd4”,“version”:7,“debugenabled”:false,“action”:“light.turn_on”,“floorId”:,“areaId”:,“deviceId”:,“entityId”:[“light.lr_desk_spot_light”],“labelId”:,“data”:“”,“dataType”:“json”,“mergeContext”:“”,“mustacheAltTags”:false,“outputProperties”:,“queue”:“none”,“blockInputOverrides”:false,“domain”:“light”,“service”:“turn_on”,“x”:930,“y”:460,“wires”:[[“843d5c66beb3753f”]]},{“id”:“5a07c720fd7d25c0”,“type”:“inject”,“z”:“cdd1f3af1e96317f”,“g”:“da6f835974f882e4”,“name”:“”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“topic”:“”,“payload”:“on”,“payloadType”:“str”,“x”:330,“y”:500,“wires”:[[“ed2b7f0f042ba8b0”]]},{“id”:“584c3231cabb0494”,“type”:“inject”,“z”:“cdd1f3af1e96317f”,“g”:“da6f835974f882e4”,“name”:“”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“topic”:“”,“payload”:“off”,“payloadType”:“str”,“x”:330,“y”:560,“wires”:[[“ed2b7f0f042ba8b0”]]},{“id”:“49f73a6c.255cd4”,“type”:“server”,“name”:“Home Assistant”,“addon”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“”,“connectionDelay”:false,“cacheJson”:false,“heartbeat”:false,“heartbeatInterval”:“”,“areaSelector”:“id”,“deviceSelector”:“id”,“entitySelector”:“id”,“statusSeparator”:“”,“enableGlobalContextStore”:false}]
Example 2 Without a Function Node
[{“id”:“5d4cbccc553574be”,“type”:“group”,“z”:“cdd1f3af1e96317f”,“name”:“Test 2”,“style”:{“label”:true},“nodes”:[“32a6cacf591364fe”,“0822929eb1258a40”,“16823c7600fb4aa7”,“c54838551542ef98”,“0e49e55e82632879”],“x”:234,“y”:679,“w”:1052,“h”:162},{“id”:“32a6cacf591364fe”,“type”:“debug”,“z”:“cdd1f3af1e96317f”,“g”:“5d4cbccc553574be”,“name”:“debug 4”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“statusVal”:“”,“statusType”:“auto”,“x”:1180,“y”:760,“wires”:},{“id”:“0822929eb1258a40”,“type”:“api-call-service”,“z”:“cdd1f3af1e96317f”,“g”:“5d4cbccc553574be”,“name”:“Test on”,“server”:“49f73a6c.255cd4”,“version”:7,“debugenabled”:false,“action”:“light.turn_on”,“floorId”:,“areaId”:,“deviceId”:,“entityId”:[“light.lr_desk_spot_light”],“labelId”:,“data”:“{"color_name": "blue", "brightness_pct": 90}”,“dataType”:“json”,“mergeContext”:“”,“mustacheAltTags”:false,“outputProperties”:,“queue”:“none”,“blockInputOverrides”:false,“domain”:“light”,“service”:“turn_on”,“x”:900,“y”:720,“wires”:[[“32a6cacf591364fe”]]},{“id”:“16823c7600fb4aa7”,“type”:“inject”,“z”:“cdd1f3af1e96317f”,“g”:“5d4cbccc553574be”,“name”:“”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“topic”:“”,“payload”:“on”,“payloadType”:“str”,“x”:330,“y”:720,“wires”:[[“0822929eb1258a40”]]},{“id”:“c54838551542ef98”,“type”:“inject”,“z”:“cdd1f3af1e96317f”,“g”:“5d4cbccc553574be”,“name”:“”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“topic”:“”,“payload”:“off”,“payloadType”:“str”,“x”:330,“y”:800,“wires”:[[“0e49e55e82632879”]]},{“id”:“0e49e55e82632879”,“type”:“api-call-service”,“z”:“cdd1f3af1e96317f”,“g”:“5d4cbccc553574be”,“name”:“Test off”,“server”:“49f73a6c.255cd4”,“version”:7,“debugenabled”:false,“action”:“light.turn_off”,“floorId”:,“areaId”:,“deviceId”:,“entityId”:[“light.lr_desk_spot_light”],“labelId”:,“data”:“”,“dataType”:“json”,“mergeContext”:“”,“mustacheAltTags”:false,“outputProperties”:,“queue”:“none”,“blockInputOverrides”:false,“domain”:“light”,“service”:“turn_off”,“x”:900,“y”:800,“wires”:[[“32a6cacf591364fe”]]},{“id”:“49f73a6c.255cd4”,“type”:“server”,“name”:“Home Assistant”,“addon”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“”,“connectionDelay”:false,“cacheJson”:false,“heartbeat”:false,“heartbeatInterval”:“”,“areaSelector”:“id”,“deviceSelector”:“id”,“entitySelector”:“id”,“statusSeparator”:“”,“enableGlobalContextStore”:false}]
Please let me know if I am doing something wrong, but this was working fine using the old Call Service node.
Thanks for any assistance you can offer.