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

Sorry if this has been asked before but I searched and couldnā€™t find anything.

I have set a style padding 20px on the pop up card to give a bit of spacing however on mobile this pushes the content off the screen.

Does the styles support media queries or is there a better way to not have any styles for mobile pop ups and only desktop pop ups?

I have a question with using browser_mod. I know it creates a media player for what ever web page is open. Can I use this media player to play music (mp3 file) to this device using the service: media_player.media_play?
What I am trying to accomplish is someway to play a local mp3 to a wall mount tablet. I donā€™t have any google home devices only amazon echo dots and an android tablet.

Thank you this worked, been trying to get this to work for a long time.

I ended up using

entity_id: media_player.garage_pc
media_content_id: "/local/alarm.mp3"
media_content_type: "music"

Hi, i have this code about popup_cards:

popup_cards:
  light.yeelight_3:
    title: Luce 3
    card:
      type: custom:mod-card
      style: |
        ha-card {
          border-radius: 20px;
          background: white;
          padding: 8px;
        }  
      card:
        type: custom:slider-entity-row
        entity: light.yeelight_3
        hide_when_off: true
        toggle: false
        full_row: true

And i have this in my frontend:

Schermata 2020-04-26 alle 16.32.32

How to stylish also the upper part of this card? I can put styles in the slider-entity-row card, but not in the popup_cards.
Any hints?
I tried also to stylish directly the browser_mod popup but unsuccesfullyā€¦

Hello. I have some problem with ā€œbrowser_mod.popupā€ service. When I use it inside of any card like ā€œbuttonā€ or ā€œglanceā€ it works very good, no problems, I put ā€œdeviceIDā€ ā€œthisā€ and the popup windows opens in the browser of device where I call it. But I need to call ā€œbrowser_mod.popupā€ service from script or automation. When I do it and put ā€œdeviceIDā€ ā€œthisā€ in script or automation popup window opens not on the device I called it, it opens on device where is HA running, but I need it to be opened on device from which I called it. If I leave ā€œdeviceIDā€ blank, of course it opens on all devices but it is not solution I need. May be some one knows how to solve this problem?

You have to make the script aware of where it was called from, as in the example in the cookbook linked from the readme.

First of all:

From the slider-entity-row readme:

Add a slider to rows in lovelace entities cards. (emphasis added)

From the card-mod readme:

IMPORTANT: mod-card is a workaround for the very few cases where normal usage of card-mod does not work. I cannot stress this enough (apparently). If you every find yourself typing type: custom:mod-card , stop, go back, read this readme all the way through again , and realized that in approximately 10 out of 10 cases, you should NOT use mod-card .

Second:
The popup has itā€™s own style parameter fro styling the header and such. Thereā€™s an example in the readme.

It seems i used the custom slider-entity-row inside an entities card:

                        card:
                          type: entities
                          entities:    
                            - type: custom:slider-entity-row
                              entity: light.yeelight_1
                              hide_when_off: true
                              hide_state: true
                              full_row: true
                              toggle: false

I changed into:

                    hold_action:
                      action: call-service
                      service: browser_mod.popup
                      style:
                        background: white
                        border-radius: 20px
                      service_data:
                        title: Slider
                        card:

But i get no change, always black background and no border-radiusā€¦
Where i am still wrong?

EDIT: Solved! Bad indentationā€¦

Ok, so in your opinion which is the better option?

I have a several horizontal stacks and each one I only show if an input_boolean is greater than a certain number. I do this using display: none if the condition is met

Should I (in your opinion)

  1. Continue using horizontal-stack like this (which works well for me):
type: custom:mod-card
style: |
  ha-card {
    {% raw %}
    {% set zone = {% endraw %} {{ zone }} {% raw %} %}
    {% set zone_count = states('input_number.irrigation_number_of_zones') %}
    {% if (zone_count | int) < (zone | int) %}
      display: none
    {% else %}
      border: 1px solid var(--primary-background-color);
    {% endif %}
    {% endraw %}
  }
card:

  type: horizontal-stack
  cards:
    etc...
  1. Or change to using the style on a custom:stack-in-card? (Iā€™m assuming I can achieve what I want this way, I havenā€™t actually tried yet.)

I suppose my question boils down to:
What is it that is so ā€˜badā€™ about using mod-card?

EDIT: I decided to remove my mod-card and went with option 2. Hopefully youā€™ll tell me if this was the wrong call. But you are pretty insistent that mod-card is the wrong choice.

I try to use deviceID: ā€œ{{ deviceID }}ā€ but it doesnā€™t work.

mod-card in itself is not bad, but to use it where it is not required adds more problems than it solves.

As a bad example (DO NOT DO THIS), I see lots of:

type: custom:mod-card
# AGAIN, THIS IS A BAD EXAMPLE
style: |
  ha-card {
    --primary-color: red;
    # add various workarounds and hoop-jumping caused by unnecessarily using mod-card here
  }
card:
  type: entities
  entities:
    ...

that should have been

type: entities
style: |
  ha-card {
    --primary-color: red;
  }
entities:
  ...

Your example is actually a good one, using mod-card there makes sense, but using stack-in-card is also a great method which I assume makes your configuration easier too.
You could also use state-switch to avoid the jinja template processing and increase performance a tad.

Can you tell me please, is it possible to store ā€œdeviceIDā€ value as input_text?

Thanks, yes I looked at state-switch a while ago but I donā€™t think I managed to get it to display no card at all, if i remember rightly it was ā€˜display one card OR anotherā€™.

But Iā€™ll take another look.

I have no idea what you mean or what you wish to accomplish.

I am trying to call pop up window when I am disarming Template Alarm Control Panel.

My panel code:

- platform: template
  panels:
    safe_alarm_panel:
      value_template: "{{ states('alarm_control_panel.perimetr') }}"
      arm_away:
        service: alarm_control_panel.alarm_arm_away
        data:
          entity_id: alarm_control_panel.perimetr
      disarm:
        - service: script.entrance_panel_button_perimetr_disarm
          data_template:
            deviceID:
              - this

and script:

entrance_panel_button_perimetr_disarm:
  sequence:
    - service: browser_mod.popup
      data_template:
        deviceID: "{{ deviceID }}"
        title: "Keyboard" 
        large: false
        card:
          type: alarm-panel
          entity: alarm_control_panel.perimetr_s_kodom
          name: Perimetr
          states:
             - arm_away
1 Like

Browser_mod will inject the deviceID in any call-service action from the frontend where it finds deviceID: this.
If you cannot call a service or cannon change its data, then thereā€™s no way for the backend to know which device the action originated from, unfortunately.

I added the code to the previous post. Can you check it please?

I am having problems with browser_mod not seeing my fire 8 tablet while using fully kiosk browser. It will detect the tablet id if I use Chrome browser on the fire 8 tablet, but for some reason I canā€™t get it to create any id while using fully. The version of Fully I am using is 1.38 Fire. I donā€™t know if there is settings inside Fully that is preventing browser_mod from working or not. Have tried restarting HA several times, cleared cache, tried local address of HA and duckdns address. I can get browser mod to see my phone and desktop pc and use light and media player on those. Any help would be much appreciated.

That wonā€™t work, unfortunately, because the disarm service call is run from the backend.
I donā€™t know of any way to accomplish what you are trying to do. Sorry.

Do you have the paid PRO version?
That shouldnā€™t be a requirement for some functionality. Just trying to find out what could be wrong.