Node Red Error: "HomeAssistantError: not a valid value @ data['recordKey']"

I’m using Node Red to pass a boost command to my Wiser heating.

If I inject directly, the node works fine, but as part of the flow I get the error:

"HomeAssistantError: not a valid value @ data['recordKey']"

I’m not sending recordKey anywhere, so super confused why this wouldn’t work - if I set the payload to blank it works, but messes up my flow…

This portion works:

[{"id":"dd3daf4e146032ea","type":"inject","z":"c3154991461cf27c","name":"","props":[{"p":"payload.name","v":"Study","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":170,"y":340,"wires":[["7cf0985b4af0b9d9"]]},{"id":"7cf0985b4af0b9d9","type":"switch","z":"c3154991461cf27c","name":"","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"Alana's Owl","vt":"str"},{"t":"eq","v":"Bathroom","vt":"str"},{"t":"eq","v":"Bedroom","vt":"str"},{"t":"eq","v":"Fire TV 4k","vt":"str"},{"t":"eq","v":"Playroom","vt":"str"},{"t":"eq","v":"Dining Room","vt":"str"},{"t":"eq","v":"Kitchen Echo Show","vt":"str"},{"t":"eq","v":"Open Plan","vt":"str"},{"t":"eq","v":"TV Echo Dot","vt":"str"},{"t":"eq","v":"Andy's Fire TV Cube","vt":"str"},{"t":"eq","v":"Study","vt":"str"},{"t":"eq","v":"Ethan's Dragon","vt":"str"}],"checkall":"true","repair":false,"outputs":12,"x":370,"y":340,"wires":[["2c26cd92f39c7771"],["1443caeac296fba0"],["26b9fe5adfc9cd59"],["6f5c2aea887495c3"],["6f5c2aea887495c3"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["8deb60af2c44f704"],["cb27e88977a21150"]]},{"id":"8deb60af2c44f704","type":"change","z":"c3154991461cf27c","name":"Study","rules":[{"t":"set","p":"room","pt":"msg","to":"the Study","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":440,"wires":[["bc004ed34be88003","72f811c8aaa070e7"]]},{"id":"72f811c8aaa070e7","type":"api-call-service","z":"c3154991461cf27c","name":"Boost Study","server":"3aa13fed.bf745","version":7,"debugenabled":false,"action":"wiser.boost_heating","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.wiser_study"],"labelId":[],"data":"{\"time_period\":60,\"temperature_delta\":3}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"wiser","service":"boost_heating","x":910,"y":440,"wires":[[]]},{"id":"3aa13fed.bf745","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

But if I stick it as part of a wider flow, it fails:

[{"id":"a781aa42cc8ba723","type":"trigger-state","z":"c3154991461cf27c","name":"Alexa Boost Helper","server":"3aa13fed.bf745","version":5,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entities":{"entity":["input_boolean.alexa_boost_heating_helper"],"substring":[],"regex":[]},"debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":110,"y":40,"wires":[["75de21f2b60163b4","f291ab904e293e43","dcab8263d2e286c4"],[]]},{"id":"dcab8263d2e286c4","type":"delay","z":"c3154991461cf27c","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":120,"y":100,"wires":[["bfa8e1dc9d80025d"]]},{"id":"bfa8e1dc9d80025d","type":"alexa-remote-other","z":"c3154991461cf27c","name":"Get Activities for Boost","account":"c494972916da5668","config":{"option":"get","value":{"what":"activities","count":{"type":"num","value":"1"},"offset":{"type":"num","value":"1"}}},"x":320,"y":100,"wires":[["66984a104338f5e3","743f018f106f43aa"]]},{"id":"743f018f106f43aa","type":"change","z":"c3154991461cf27c","name":"Get Device [multi response]","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t   $$.payload[\t       \"CUSTOMER_TRANSCRIPT\" in $keys($.conversionDetails) and\t\t    $.description.summary in [\t           \"boost the heating\",\t           \"heating boost\",\t           \"it's cold\"\t       ]\t   ]\t][0]","tot":"jsonata"},{"t":"set","p":"notes","pt":"msg","to":"Getting customer transcript item","tot":"str"},{"t":"set","p":"morenotes","pt":"msg","to":"- 0 first list item -1 last","tot":"str"},{"t":"set","p":"helpthread","pt":"msg","to":"https://discourse.nodered.org/t/obtaining-last-alexa-device-called-using/92267/15","tot":"str"},{"t":"set","p":"NOTE","pt":"msg","to":"use payload.name","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":160,"wires":[["7cf0985b4af0b9d9","f12709dec80ef52d"]]},{"id":"7cf0985b4af0b9d9","type":"switch","z":"c3154991461cf27c","name":"","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"Alana's Owl","vt":"str"},{"t":"eq","v":"Bathroom","vt":"str"},{"t":"eq","v":"Bedroom","vt":"str"},{"t":"eq","v":"Fire TV 4k","vt":"str"},{"t":"eq","v":"Playroom","vt":"str"},{"t":"eq","v":"Dining Room","vt":"str"},{"t":"eq","v":"Kitchen Echo Show","vt":"str"},{"t":"eq","v":"Open Plan","vt":"str"},{"t":"eq","v":"TV Echo Dot","vt":"str"},{"t":"eq","v":"Andy's Fire TV Cube","vt":"str"},{"t":"eq","v":"Study","vt":"str"},{"t":"eq","v":"Ethan's Dragon","vt":"str"}],"checkall":"true","repair":false,"outputs":12,"x":370,"y":340,"wires":[["2c26cd92f39c7771"],["1443caeac296fba0"],["26b9fe5adfc9cd59"],["6f5c2aea887495c3"],["6f5c2aea887495c3"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["3d3abc1ad45e3482"],["8deb60af2c44f704"],["cb27e88977a21150"]]},{"id":"8deb60af2c44f704","type":"change","z":"c3154991461cf27c","name":"Study","rules":[{"t":"set","p":"room","pt":"msg","to":"the Study","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":440,"wires":[["bc004ed34be88003","72f811c8aaa070e7"]]},{"id":"72f811c8aaa070e7","type":"api-call-service","z":"c3154991461cf27c","name":"Boost Study","server":"3aa13fed.bf745","version":7,"debugenabled":false,"action":"wiser.boost_heating","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.wiser_study"],"labelId":[],"data":"{\"time_period\":60,\"temperature_delta\":3}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"wiser","service":"boost_heating","x":910,"y":440,"wires":[[]]},{"id":"bc004ed34be88003","type":"template","z":"c3154991461cf27c","name":"","field":"output","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Now Boosting the Heating in {{room}}","output":"str","x":900,"y":140,"wires":[["38f54553813d8cce","cb0e1e6fe2bca4be"]]},{"id":"cb0e1e6fe2bca4be","type":"alexa-remote-routine","z":"c3154991461cf27c","name":"Message on Alexa that was used","account":"c494972916da5668","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"msg","value":"output"},"devices":{"type":"msg","value":"payload.deviceSerialNumber"}}},"x":1180,"y":120,"wires":[[]]},{"id":"3aa13fed.bf745","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"c494972916da5668","type":"alexa-remote-account","name":"Alexa Account","authMethod":"proxy","proxyOwnIp":"192.168.1.125","proxyPort":"3456","cookieFile":"/homeassistant/node-red/alexa-auth.txt","refreshInterval":"3","alexaServiceHost":"alexa.amazon.co.uk","pushDispatchHost":"","amazonPage":"amazon.co.uk","acceptLanguage":"en-UK","onKeywordInLanguage":"on","userAgent":"","usePushConnection":"on","autoInit":"on","autoQueryActivityOnTrigger":"on"}]

Anyone got any ideas

The error message

“HomeAssistantError: not a valid value @ data[‘something’]”

is telling you that the Action (call service) node is sending a Data object that contains a key (‘something’) that the particular action in Home Assistant was not expecting or has an incorrect value.

The HA action processor looks up all the Data field keys and checks that the values are acceptable for the particular Action (service), hence “brightness”: 300 would fail for ‘turn on a light’ action as the value is out of range.

If you are not setting the Data object with {“recordKey”: “value”} directly, then I would assume that it is already being set on input as the result of a node setting msg.payload earlier in the flow.

The Action node accepts msg.payload as an object, and any key fields will be added to / overwrite the UI data field. Hence msg.payload = {“data”: {“recordKey”: 42}} would merge and set the Data field accordingly.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/action.html#input

The latest version of the Action node has a ‘Block Input Overrides’ option, which does just that.

I suggest you drop a complete-message debug node into the flow ahead of the Action node to see exactly what is going inwards, and if necessary overwrite msg.payload to a primitive value [“not required”] or a blank object {} and try that.
Or update WebSocket nodes to the latest version which blocks input overrides by default.

I don’t have the specific nodes you are using so I can’t test this myself.

1 Like

Thanks!
I did not realise this - i’m surprised this hasn’t caused an issue for me before
The msg.payload had a lot of things in it (intentionally) so i’ve solved this by just whacking a change node before the action node to clear it out