Node-RED Companion integration with HA / Node-RED stopped working

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!

To not have to modify your NR flows you could have used.

data:
  message:
    payload: beneden,BNRN

Hi @Krammie ,

I am pulling my hair out trying to get the updated flows to work.

I updated the code as above and the switch.nodered_media in your example gets triggered … however … no payload comes through … only the below
image

Did you have to re-create the switch in the node-red flow?

Solved it … it was my stupid mistake …
I needed to update the palette for the HASS Websocket in NR as well. Once updated the payload came thru.

New issue :frowning:

Using the inject node I get the following message and it flows perfectly through to my Telnet client.
image

Since the update of the NR companion it seems to be adding to the message object topic: “triggered”.

image

I think this is causing my telnet client to fail as it is receiving ‘triggered’ instead of the payload.

Does anyone know how to remove the “object.topic: triggered ?