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

I installed 2.2.0 update (on Home assistant version: 2022.12.9) and after clearing cache my popups appear on top of the screen, not on the middle anymore (center of display), like they use to. Also, blur effect is not working anymore. My card:

type: custom:button-card
entity: script.onkyo_set_radio
name: Radio
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      card_mod:
        style:
          ha-dialog$: |
            div {
              backdrop-filter: blur(5px);
            }
      style: |
        --popup-border-color: lime;
        --popup-border-width: 5px;
        text-align: center;
      autoclose: true
      title: Ali vklopim internet RADIO?
      content:
        type: horizontal-stack
        cards:
          - type: custom:button-card
            styles:
              card:
                - width: 10px
          - type: custom:button-card
            name: NE!
            styles:
              card:
                - font-size: 70px
                - font-weight: bold
                - color: black
                - background: cyan
                - height: 100px
                - border-radius: 30px
          - type: custom:button-card
            styles:
              card:
                - width: 10px
          - type: custom:button-card
            name: DA!
            tap_action:
              action: call-service
              service: script.onkyo_set_radio
            show_icon: false
            styles:
              card:
                - font-size: 70px
                - font-weight: bold
                - background: red
                - height: 100px
                - border-radius: 30px
          - type: custom:button-card
            styles:
              card:
                - width: 10px
show_name: true
icon: mdi:radio
show_state: false
styles:
  card:
    - background: cyan
    - color: black
    - font-size: 30px
    - font-weight: bold
    - padding: 0px
    - height: 75px
    - box-shadow: inset 0 0 30px 10px  blue
  icon:
    - color: red

Above ā€œblurā€ command under ā€œcard_modā€ should blur background, it used to in 2.1.3. Not anymore in 2.2.0.
Also, i guess iā€™ll need another command to center this popupā€¦? Thomas did state that popup is ā€œbetter lookingā€ in this update, but it was pretty scarse with info what is actually changed, also his github page doesnā€™t say anything about new featuresā€¦
so, i would really need some help here, pleaseā€¦

Tried searching for an answer to this but canā€™t seem to find it. Is there a way to get the device ID (in the Lovelace UI) of the device/browser currently accessing HA? Some context:

I have a dashboard page where Iā€™m displaying an embedded web page using the web page card. Iā€™m using card_mod to scale it so the page contents fit nicely in the card. But the level of scale to apply depends on the size of the screen. What looks fine on desktop doesnā€™t look quite right on mobile.

Browser mod creates sensors for the width and height for each device. What Iā€™m trying to do to is access that e.g.:

if sensor.{client's device ID}_browser_width == xxx then ....<set scale accordingly>

I also use the ā€œblurā€ but it`s working fine. This is my code:

                  card_mod:
                    style:
                      ha-dialog$: |
                        div.mdc-dialog__scrim {
                          backdrop-filter: blur(4px) !important;
                          -webkit-backdrop-filter: blur(10px) !important;
                          background-color: rgba(0,0,0,0.1) !important;
                        }

Interestingā€¦ what i found out that blur works this way:

    data:
      card_mod:
        style:
          ha-dialog$: |
            div.mdc-dialog__scrim {
              backdrop-filter: blur(4px) !important;
              -webkit-backdrop-filter: blur(10px) !important;
              background-color: rgba(0,0,0,0.1) !important;
            }
      style: |
        --popup-border-color: lime;
        --popup-border-width: 5px;

BUTā€¦ popup (from v2.2.0) appears at TOP middle of screen. Since iā€™d like it to appear in the middle (total center of screen), i added some lines under ā€œstyleā€ - that way popup appears centered (or whenever i want it),BUT they cause blur to stop working:

    data:
      card_mod:
        style:
          ha-dialog$: |
            div.mdc-dialog__scrim {
              backdrop-filter: blur(4px) !important;
              -webkit-backdrop-filter: blur(10px) !important;
              background-color: rgba(0,0,0,0.1) !important;
            }
      style: |
        position: absolute;
        transform: translate(50%, 50%);
        left: 50%;
        top: 50%;
        width: 100px; 
        height: 300px;
        --popup-border-color: lime;
        --popup-border-width: 5px;

Hey - after update the modbrowser my popups looks like this . Itā€™s too big. Can anyone

That was the code I Used beforeā€¦ and it was the correct size of the popupā€¦

card_mod:
              style: |

                :host([dark-mode]) {
                  background: rgba(var(--rgb-primary-background-color), 0.2);
                } 
                :host {
                  background: rgba(var(--rgb-primary-text-color), 0.05);
                  --mush-icon-size: 50px;
                  height: 66px;
                  margin-left: -8px !important;
                }

And restore to 2.1.3 does not work ā€¦ā€¦

I have 5 devices registered in BM but when I try to add them to a BM service, only 1 is available. If I manually (YAML) enter one of the others, Navigate does not work. This is not the first time BM devices donā€™t seem to exist, yet they show on the BM settings page list. BTW, they also show in the HA Devices page.

Hey. I just found the register CAST browser option in browser_mod settings, which is great, as I can no send popup notifications to my dashboards on google nest hubs. However, one question:

Is it possible to register multiple CAST browsers individually? I have 2 hubs showing dashboards, but they appear to share the same device_id. If I choose ā€˜CASTā€™ as the target, it sends the same popup to both browsers.
Both popups can be dismissed individually, and ā€˜fire-dom-eventsā€™ work fine individually when launched from tap-actions, but canā€™t send individual browser_mod.popup services.

This should give you a blur and also set the popup card centered correctly without messing with the position variables:

  card-mod-more-info-yaml: |
    .: |
      ha-dialog {
        --vertical-align-dialog: center !important;
      }      
    $: |
      .mdc-dialog {
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        background: rgba(0,0,0,0.1);
      }

Goes in your theme.yaml under card-mod-theme: yourthemename if you want it to work for all popups, default Home Assistant more-info dialogs included. This is how my popups look (I use different blur and background values)

6 Likes

Uau! Many thanks! Centering works, but interestingā€¦ with your solution blurring of browser-mod popups doesnā€™t work (browser_mod.popup, fire-dom-event), only ā€œstandardā€ HA popup windows blur.

Browser mod popups (and all other popups, too) do blur however if i add ā€œdialog-backdrop-filter: blur(5px)ā€ directly to theme (not under card-mod), so at the end itā€™s all i wanted.

Iā€™ve had to do a bit of searching and learning, but i managed to make it work. Thomasloven wrote understandable guides for it.

Hi!

I added this to my themes.yaml and the popup it is still in the top of my screen, not centeredā€¦ :frowning:
Any other idea?

ios-dark-mode:

  card-mod-theme: ios-dark-mode
  card-mod-more-info-yaml: |
    .: |
      ha-dialog {
        --vertical-align-dialog: center !important;
      }      

Did you also reload the theme through services and the refresh Lovelace?

image

I just restarted HA. Now I called the Reload themes, but no effect :frowning:

  1. Make sure you have selected that theme as active via your profile or as service call.

  2. Add the lines to theme.yaml

  3. Use the service call to reload the themes

  4. Refresh Lovelace page (or restart app if on mobile)

Nothing much I can add to this, this is the code everyone uses and works (with both 1.5 and 2.x browser_mod).

Iā€™ve restarted HA from SSH and now it is working :smiley: I donā€™t understand why, but anyway, now it is working good. Thank you!

1 Like

BTW, what means these signs from the code?
.: |
and
$

I donā€™t understand these signs and how to use them, any docs for this? Thank you again

These are DOMā€™s in the CSS code, the theme modding is code from ā€˜card modā€™ which you have installed through HACS (otherwise the code I posted wouldnā€™t have worked on your system)ā€¦

thomasloven/lovelace-card-mod: :small_blue_diamond: Add CSS styles to (almost) any lovelace card (github.com)

Itā€™s very advanced stuff. Iā€™m not an expert myself and still learning CSS. But those signs are basically navigation points inside the CSS code. I linked the Github of card-mod above. You should also visit the card-mod threads for card mods and themes if you want to explore more.

Modding cards :point_right: :small_blue_diamond: Card-mod - Add css styles to any lovelace card - Share your Projects! / Dashboards & Frontend - Home Assistant Community (home-assistant.io)

Modding themes :point_right: :small_blue_diamond: Card-mod - Super-charge your themes! - Share your Projects! / Themes - Home Assistant Community (home-assistant.io)

I also have this problem. Canā€™t figure out why the pop ups are way oversized after this update.

tagging you here as well @Deckoz2302

Browser_mod 2.x has new styling options, itā€™s documented at the Github repo: hass-browser_mod/popups.md at c46fcf222bb9b8a893af9d5f0612576359e24f10 Ā· thomasloven/hass-browser_mod Ā· GitHub

You can use them either in the popup-card, in your theme.yaml or style it using card_mod. If you want the popups to look like the old Browser_mod (and like the default more-info dialogs) just change the minimum and maximum width. I upgraded today to V2 finally and fixed it easily for all popups using this in my theme.yaml:

  popup-min-width: 400px
  popup-max-width: 400px

This gives all popups a fixed width of 400px. Change to what you see fit. In the link from Github you can find some other styling options like border-radius, background color etc.

1 Like

Interesting, so before, pop ups just auto conformed to the screen size. Now we have to set a width?

Thanks for the tip to fix. But auto conform was a whole lot better :frowning: