I recently updated a number of components within my Home Assistant system: Home Assistant Core, Node-RED, Node-RED Companion (via HACS). Since then, the buttons (picture card) in my home assistant dashboard (which in use for months without any issue) do not work anymore.
This is what I’m running at the moment:
- Home Assistant: 2023.10.1
- Node-RED: v3.1.0
- Node-RED Companion: v3.0.1
- node-red-contrib-home-assistant-websocket: 0.57.2 (this was not changed)
When I clicked one of the buttons in the dashboard, the following error message appears:
Failed to call service nodered/trigger. extra keys not allowed @ data[‘payload’]
The code looked like this:
- hold_action:
action: none
image: /local/media/bnr_nieuwsradio.png
tap_action:
action: call-service
service: nodered.trigger
service_data:
entity_id: switch.nodered_media
payload: beneden,BNRN
target: {}
type: picture
In the “Breaking changes” section of the Node-RED Companion integration I read the following: “We’ve simplified the trigger service. It now accepts only two optional data properties: output_path and message.”. Based on this information, I changed the “service data” of the picture card from “payload” to “message”. When doing so, both options (output_path and message) appeared in the UI. I didn’t change the values, saved the card and tried the new config which resulted in a new error message:
Failed to call service nodered/trigger. expected dict for dictionary value @ data[‘message’]
After some further investigation and testing, I found the solution and wanted to share this with the community. The service data should be filled in like this:
<parameter1>: <value>
<parameter2>: <value>
etc.
The code now looks like this:
type: picture
image: /local/media/bnr_nieuwsradio.png
tap_action:
action: call-service
service: nodered.trigger
target:
entity_id: switch.nodered_media
data:
message:
mediaplayer: beneden
radiostation: BNRN
Of course, the Node-RED flows also needed to be adjusted so it reads the parameters and values correctly. I hope this all helps people in solving this same issue!