Skip to content

Cookbook

Thomas Lovén edited this page Sep 4, 2022 · 10 revisions

THIS ONLY APPLIES TO BROWSER MOD 1.5 OR EARLIER


Here are some example uses. More to come!

Please let me know if you come up with something cool!

An automation which displays a camera feed when a human is detected:

By @scstraus

- id: popup_camera_when_human_detected
  alias: Popup Camera When Human Detected
  hide_entity: true
  initial_state: 'true'
  trigger:
    platform: state
    entity_id: binary_sensor.human
    to: 'on'
  action:
    - service: browser_mod.more_info
      data:
        entity_id: camera.main
        deviceID:
          - 12345678-12345678

Displaying a popup via a script

Browser_mod will replace this with the current deviceID in the deviceID field of any service call from the frontend. That can let e.g. a script know which device called it:

scripts.yaml

test_popup:
  sequence:
    - service: browser_mod.popup
      data_template:
        deviceID: "{{ deviceID }}"
        title: Testing script
        card:
          type: entities
          entities:
            - light.bed_light

Lovelace button configuration:

type: entity-button
icon: mdi:star
tap_action:
  action: fire-dom-event
  browser_mod:
    command: call-service
    service: script.test_popup
    service_data:
      deviceID:
        - this