dermotduffy / frigate-hass-card

A Lovelace card for Frigate in Home Assistant
MIT License
498 stars 57 forks source link

browser_mod.popup and querystring actions #1300

Open ronluna opened 9 months ago

ronluna commented 9 months ago

Wondering if this is currently possible (maybe undocumented) or it calls for an enhancement?

Simply trying to add a tap action on a button to call a script that loads a brwoser_mod.popup but allowing to load a specific camera/clip/whatever using querystring action. Currently querystring requires a lovelace path and since the popup loads dynamically from anywhere. There is no fixed url path so how can this scenario be put be put together using the frigate-card-action?

currently querystring requires something like this to get trigger:

  action: navigate
  navigation_path: /dashboard-name/cameras/frigate?frigate-card-action:main_nvr_popup_1:clip:clip_id

but I don't see a way to pass the frigate-card-action arguments into the script with a tap action with something like this:

type: template
entity: binary_sensor.front_door_motion
content: All Clips
icon: mdi:record
tap_action:
  action: call-service
  service: script.nvr_all_cameras
  data:
    camera_id: front_door
    card_id: main_nvr_popup_1

the script.nvr_all_cameras looks like this but there is no way to pass the arguments (camera_id, card_id) from the tap action into the frigate-card.

alias: Network Video Recorder NVR  Popup
sequence:
  - service: browser_mod.popup
    data:
      dismissable: true
      browser_id: "{{ browser_id }}"
      autoclose: false
      content:
        type: vertical-stack
        cards:
          - type: custom:frigate-card
            card_id: main_nvr_popup_1
            cameras:
              - camera_entity: camera.birdseye
                title: Birdseye
                dependencies:
                  all_cameras: true
              - camera_entity: camera.front_door
                title: Driveway
                live_provider: go2rtc
              - camera_entity: camera.back_1
                title: Front Intercom
                live_provider: go2rtc
              - camera_entity: camera.back_2
                title: Service Entrance
                live_provider: go2rtc
              - camera_entity: camera.side_1
                title: Driveway Nort to Front
                live_provider: go2rtc
            view:
              scan:
                enabled: true
            menu:
              style: outside
              buttons:
                frigate:
                  enabled: false
                timeline:
                  enabled: true
                screenshot:
                  enabled: false
                mute:
                  enabled: true
                expand:
                  enabled: false
                recordings:
                  enabled: true
                substreams:
                  enabled: false
                image:
                  enabled: false
                play:
                  enabled: false
                microphone:
                  enabled: true
            timeline:
              style: ribbon
              controls:
                thumbnails:
                  mode: below
              show_recordings: true
              media: clips
            live:
              controls:
                thumbnails:
                  mode: below
                next_previous:
                  style: chevrons
                title: {}
                builtin: true
              layout:
                fit: fill
              lazy_load: true
              draggable: false
            media_viewer:
              controls:
                next_previous:
                  style: none
                thumbnails:
                  mode: below
                title: {}
                timeline:
                  mode: below
                  style: ribbon
                  media: clips
              draggable: false
              transition_effect: none
              layout:
                position:
                  x: 0
                  "y": 0
                fit: cover
              snapshot_click_plays_clip: false
            media_gallery:
              controls:
                thumbnails:
                  show_details: true
                filter:
                  mode: left
            performance:
              features:
                animated_progress_indicator: true
              style:
                border_radius: true
                box_shadow: true
            dimensions:
              min_height: "2500"
      title: 11850 NVR
mode: parallel
max: 10
icon: mdi:cctv

is this possible? any ideas ?

dermotduffy commented 5 months ago

Simply trying to add a tap action on a button to call a script that loads a brwoser_mod.popup but allowing to load a specific camera/clip/whatever using querystring action.

Could you describe what you're trying to achieve in a little more detail? Sounds like you want a button on the card you can press, and when you press it you want a popup to open a particular named clip. Is that right?