Node-Red, browsermod and formatting issue

Wonder if anyone has any suggestions, I’m wanting to use Node-Red for the following automation. On door-bell press popup video feed to a device using a browsermod service. I’ve got it 99% there but failing with one small part, suspect I need to escape a hyphen.

I do get the popup, so data is being passed to HA and browsermod is working, however, it’s displaying an invalid formatting error for the lovelace card. I’ve tracked the issue down to the following:

I have the following in the data field of a call service node:

    "cameras":{
        "- camera_entity": "camera.g4_doorbell_medium_insecure",
          "camera_name": "door_bell",
          "frigate_url": http://192.168.1.166:5000,
          "live_provider": "webrtc-card",
          "webrtc_card":{
            "entity": "camera.g4_doorbell_medium_insecure"
         }

Output in Home Assistant front end error is:

cameras:
  '- camera_entity': camera.g4_doorbell_medium_insecure
  camera_name: door_bell
  frigate_url: http://192.168.1.166:5000
  live_provider: webrtc-card
  webrtc_card:
    entity: camera.g4_doorbell_medium_insecure

Issue is this line:

 '- camera_entity': camera.g4_doorbell_medium_insecure

I need it to not produce the ‘ around – camera_entity

Full code being used in node-red service call node:

{
    "title": "Door Bell",
    "card": {
        "type": "custom:frigate-card",
        "motion_entity": "binary_sensor.front_gate_person_motion",
        "menu": {
            "mode": "overlay-bottom",
            "buttons": {
                "frigate_ui": false,
                "frigate": false,
                "snapshots": false,
                "clips": true,
                "fullscreen": true,
                "download": false
            }
        },
        "entities": {
            "- entity": "group.motion_frontgarden",
            "show": true
        },
        "view": {
            "default": "live"
        },
        "event_viewer": {
            "controls": {
                "next_previous": {
                    "style": "chevrons"
                },
                "auto_play": true
            }
        },
        "dimensions": {
            "aspect_ration_mode": "static"
        },
        "cameras": {
            "- camera_entity": "camera.g4_doorbell_medium_insecure",
            "camera_name": "door_bell",
            "frigate_url": "http://192.168.1.166:5000",
            "live_provider": "webrtc-card",
            "webrtc_card": {
                "entity": "camera.g4_doorbell_medium_insecure"
            }
        },
        "event_gallery": {
            "min_column": 5
        }
    },
    "deviceID": [
        "eoin_laptop"
    ],
    "large": "true",
    "hide_header": "true"
}

Full error on the popup:

type: custom:frigate-card
motion_entity: binary_sensor.front_gate_person_motion
menu:
  mode: overlay-bottom
  buttons:
    frigate_ui: false
    frigate: false
    snapshots: false
    clips: true
    fullscreen: true
    download: false
entities:
  '- entity': group.motion_frontgarden
  show: true
view:
  default: live
event_viewer:
  controls:
    next_previous:
      style: chevrons
    auto_play: true
dimensions:
  aspect_ration_mode: static
cameras:
  '- camera_entity': camera.g4_doorbell_medium_insecure
  camera_name: door_bell
  frigate_url: http://192.168.1.166:5000
  live_provider: webrtc-card
  webrtc_card:
    entity: camera.g4_doorbell_medium_insecure
event_gallery:
  min_column: 5

In yaml a - is used, but in json they are not used.
That said. I don’t know if that is the problem.

The - is used to create an array so this:

cameras:
  '- camera_entity': camera.g4_doorbell_medium_insecure
  camera_name: door_bell
  frigate_url: http://192.168.1.166:5000
  live_provider: webrtc-card
  webrtc_card:
    entity: camera.g4_doorbell_medium_insecure

assuming there is indentation errors and correction for that should be:

{
  "cameras": [
    {
      "camera_entity": "camera.g4_doorbell_medium_insecure",
      "camera_name": "door_bell",
      "frigate_url": "http://192.168.1.166:5000",
      "live_provider": "webrtc-card",
      "webrtc_card": null,
      "entity": "camera.g4_doorbell_medium_insecure"
    }
  ]
}

in json

1 Like

@Hellis81, thank you so much! That fixed it :slight_smile:

It did? I just spotted an error.
I think I made an mistake in the “indentation fix”.

entity is no longer part of webrtc_card. I think it should be:

{
  "cameras": [
    {
      "camera_entity": "camera.g4_doorbell_medium_insecure",
      "camera_name": "door_bell",
      "frigate_url": "http://192.168.1.166:5000",
      "live_provider": "webrtc-card",
      "webrtc_card": {
          "entity": "camera.g4_doorbell_medium_insecure"
      }
    }
  ]
}

lol, I manually copied over your suggestion, in particular the [ ] part, leaving the webrtc_card part which was luckily already correct :slight_smile:

hi, when i call a popup from ha using devoloper tools the popup is working
but when i put that code (converted to json) its showing an empty popup what will be the reason, can anyone help

the code in json is this

{
“service”: “browser_mod.popup”,
“data”: {
“content”: {
“type”: “custom:mushroom-alarm-control-panel-card”,
“entity”: “alarm_control_panel.klm_nettoor”,
“states”: [
“armed_away”
],
“fill_container”: true,
“layout”: “vertical”
},
“title”: “test”
},
“target”: {
“entity_id”: “media_player.cctv_1_edge”
}
}

Put the code into code blocks, it’s in an unusable state when it’s posted as text.

When posting to node red it’s very helpful to supply the entire flow. Highlight the nodes by selecting them. On the right, hamburger menu, choose export and copy to clipboard. Then post that output in code blocks.