šŸ”¹ Browser_mod - turn your browser into a controllable device, and a media_player

I do not understand. Where did this deviceID get? thanks.

Iā€™m struggling with browser_mod. Everything (everything I tested) is working perfectly on chrome on my laptop. But I canā€™t do anything with my android phone. I managed to get a device id for my phone (I donā€™t know how I did), so it works for few hours but the device went unavailable and nothing is working on my phone anymore (I mean popup etc.).

Also, Iā€™m not able to have a device created for my wifeā€™s phone. I tried many thing like cache cleaning and phone restart, etc.

I created an issue Can't manage to have a deviceID generated for android app Ā· Issue #222 Ā· thomasloven/hass-browser_mod Ā· GitHub

Does anybody have any tips ?

Found now several workarrounds, one included in PR

could anyone possibly help me understand why nothing happens when I click the horseshoe card referenced below?

Script

browser_popup_climate:
  sequence:
  - service: browser_mod.popup
    data_template:
      deviceID:
        - 48b8a5de-47e9ac05
      card:
        type: custom:thermostat-popup-cards
        entity: climate.downstairs

Lovelace (scroll to bottom for tap action on horseshoe card)

          - type: vertical-stack
            cards:
              - type: 'custom:flex-horseshoe-card'
                card_mod:
                  style: |
                    ha-card {
                    background-color: var(--primary-background-color)
                    height: 118px;
                    width: 118px;
                    border-radius: 30px;
                    }
                entities:
                  - entity: climate.downstairs
                    attribute: current_temperature
                    decimals: 1
                    name: Downstairs
                    unit: Ā°F
                  - entity: climate.downstairs
                    attribute: temperature
                    decimals: 0
                    unit: Ā°F
                    icon: 'mdi:thermometer'
                  - entity: climate.downstairs
                    attribute: current_humidity
                    decimals: 0
                    unit: '%'
                    icon: 'mdi:water'
                show:
                  horseshoe_style: lineargradient
                  scale_tickmarks: true
                layout:
                  hlines:
                    - id: 0
                      xpos: 50
                      ypos: 50
                      length: 50
                      styles:
                        - stroke: var(--primary-text-color);
                        - stroke-width: 5;
                        - stroke-linecap: round;
                        - opacity: 0.7;
                  states:
                    - id: 0
                      entity_index: 0
                      xpos: 50
                      ypos: 42
                      styles:
                        - font-size: 3em;
                    - id: 1
                      entity_index: 1
                      xpos: 29
                      ypos: 66
                      styles:
                        - text-anchor: start;
                        - font-size: 1.9em;
                    - id: 2
                      entity_index: 2
                      xpos: 62
                      ypos: 66
                      styles:
                        - text-anchor: start;
                        - font-size: 1.9em;
                  icons:
                    - id: 0
                      entity_index: 1
                      xpos: 28
                      ypos: 65
                      align: end
                      size: 1.3
                    - id: 1
                      entity_index: 2
                      xpos: 61
                      ypos: 65
                      align: end
                      size: 1.3
                  names:
                    - id: 0
                      entity_index: 0
                      xpos: 50
                      ypos: 90
                horseshoe_scale:
                  min: 50
                  max: 90
                color_stops:
                  '50': blue
                  '90': red
                tap_action:
                  action: fire-dom-event
                  browser_mod:
                    command: call-service
                    service: script.browser_popup_climate
                    service_data:
                      deviceID:
                        - 48b8a5de-47e9ac05

so far as I can tell I have the browser mod and thermostat popup card functioning correctly, but here is the resultā€¦what could it be?

Slightly off-topic, but why this difference? I wonder if this is by a HA Dev design choice, or a must?
If only a fraction of my fellow HA users have wasted just a fraction of the time I have - fighting this difference, then I think it deserves attention - if at all possible to change?
I know, itā€™s plain and straight forward and should be easy to remember, but as you so elegantly put it yourself; " with a lot of other plugins and stuff running through ones head while writing (whatever)ā€¦" it becomes so easy to overlook the obvious. Especially with 110% mindset on new Custom Card YAML or a new integration Template.
If Front-End and Back-End had been using the same syntax, life with HA would be a lot easier.

1 Like

Hello,
Please, how to call popup from popup correctly?
It works, but the second popup closes the first one (doesnā€™t show in front of it).
Is it possible?

I am creating a button-card in popup but the following command to display the brightness in the label is not displayed in browser_mod, while in lovelace it works regularly.
I can fix this?

        - type: custom:button-card
          icon: mdi:lightbulb
          entity: input_boolean.prova
          aspect_ratio: 1/1
          name: Test
          label: Ciao
          show_state: true
          show_label: true
          tap_action:
            action: fire-dom-event
            browser_mod:
              command: popup
              title: "Prova"
              card:
                type: custom:button-card
                icon: mdi:lightbulb
                entity: light.led_tv
                aspect_ratio: 1/1
                name: Test
                show_state: true
                show_label: true
                label: "[[[ if (typeof(entity) === 'undefined') return; if ('brightness' in entity.attributes) { if (entity.attributes && (entity.attributes.brightness <= 255)) { var bri = Math.round(entity.attributes.brightness / 2.55); return (bri ? bri : '0') + '%'; } } ]]]"

The Home Assistant has a trick, it is to take snapshots of the state and then you can return to the state as it was before. We are talking about scene.create service. Can this be applied to browser_mod.navigate navigation? For example, I had page 1 open, then after starting the trigger, I opened page 2, when the trigger is re-triggered, it should return to page 1. Thus, no matter which page was opened, the return will always be to the page that was opened before switching.

hello, you have found the solution to that error, Iā€™ve been seeing the same message in the log for a while

Logger: homeassistant
Source: helpers/entity.py:340
First occurred: 1:27:30 (1 occurrences)
Last logged: 1:27:30

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 340, in async_update_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <Entity None: 1>

Same here. The. combination of custom:button-card as container and popup-content custom:button-cardincluding Javascript causes display errors.

1 Like

hi, please could someone help me out - I am using custom-button-card - and wanted to combine it with browser-mod. What I want to achieve is popup just on the device where the custom-button was pressed.

This is my code so far - it does work, but popup shows on every device.

tap_action:
  action: call-service
  service: browser_mod.popup
  service_data:
    data_template: null
    title: Mistral Smart 400 + CleanR
    large: false
    card:
      type: custom:vertical-stack-in-card
      cards:
        - type: entities
          entities:
            - entity: switch.gosund_sp111_reku
              name: Rekuperator
              icon: hass:fan
        - type: gauge
          entity: sensor.gosund_sp111_reku_energy_power
          min: 0
          name: aktualne zuzycie
          max: 500
          severity:
            green: 0
            yellow: 200
            red: 250
        - type: glance
          entities:
            - entity: sensor.reku_daily_combined_cost
              name: Dzienny
              icon: hass:cash
            - entity: sensor.reku_monthly_combined_cost
              name: Miesieczny
              icon: hass:cash
            - entity: sensor.reku_yearly_combined_cost
              name: Roczny
              icon: hass:cash
          show_name: true
          show_icon: true
          show_state: true
          columns: 3

Use fire-dom-event:


tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    large: false
    hide_header: false
    title:
    card:
      type: 

amazing - thank you!!!

i have browser mode on my tablet, after update it is gone
when i try " Browser mod: debug" doesnt show any more on that tablet, doesnt show device_id

tap_action:
  action: call-service
  service: browser_mod.popup
  service_data:
    title: Popup example
    card:
      type: entities
      entities:
        - camera.lenovostick_screen_0
    deviceID:
      - this
  target: {}
entity: sensor.time_since_most_recent
hold_action:
  action: none

instead of getting the camera entity popup for current running device only, i get the default tap action for the sensor.time_since_most_recent sensor (more info-esque dialog box). what am i doing wrong?

  - this

is deprecated. Use alias (if given) or the bare deviceID.

Oh really? Why did they take this function away? it was very useful. Is there any way to automatically include all devices?

1 Like

I just canā€™t get it to work. Could someone give me a hand? This was the code I had (I donā€™t want to specify any ID):

name: RƔdio
entity: input_boolean.radio_da_suite
show_entity_picture: true
size: 10%
styles:
  card:
    - height: 7em
state:
  - entity_picture: /local/img/icones/radio-on.gif
    value: 'on'
  - entity_picture: /local/img/icones/radio-off.png
    value: 'off'
tap_action:
  haptic: light
  action: call-service
  service: script.radio_suite_toggle
hold_action:
  action: call-service
  service: browser_mod.popup
  service_data:
    card:
      cards:
        - cards:
            - color: red
              color_type: card
              icon: mdi:power
              name: Ligar/Desligar
              styles:
                name:
                  - font-weight: bold
              tap_action:
                action: call-service
                service: script.radio_suite_toggle
              type: custom:button-card
          type: horizontal-stack
        - cards:
            - color_type: blank-card
              styles:
                card:
                  - height: 1em
              type: custom:button-card
          type: horizontal-stack
      type: vertical-stack
    deviceID:
      - this
      - dashboard
    title: RƔdio da Suƭte
type: custom:button-card

So i tried:

name: RƔdio
entity: input_boolean.radio_da_suite
show_entity_picture: true
size: 10%
styles:
  card:
    - height: 7em
state:
  - entity_picture: /local/img/icones/radio-on.gif
    value: 'on'
  - entity_picture: /local/img/icones/radio-off.png
    value: 'off'
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    large: false
    hide_header: false
    title: RƔdio da Suƭte
    card:
      cards:
        - cards:
            - color: red
              color_type: card
              icon: mdi:power
              name: Ligar/Desligar
              styles:
                name:
                  - font-weight: bold
              tap_action:
                action: call-service
                service: script.radio_suite_toggle
              type: custom:button-card
          type: horizontal-stack
        - cards:
            - color_type: blank-card
              styles:
                card:
                  - height: 1em
              type: custom:button-card
          type: horizontal-stack
      type: vertical-stack
type: custom:button-card

But didnt work either.