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

I donā€™t know why but now when i restart HA, my devices turn unavailable and a swipe donā€™t change anythingā€¦ I need to remove all the integration and start the process from scratch.

I think style must be a single text string:

style: |
  width: 70%;

Try that.

I have been desperately trying to figure out how to play a radio station on the current device by just clicking a button. In particular, I seem unable to get the hang of the usage of ā€œTHISā€.

Here is my latest failed :confused: attempt:

show_name: true
show_icon: true
type: button
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.sequence
    data:
      sequence:
        - service: media_player.play_media
          data:
            media_content_id: media-source://radio_browser/d45a9c6f-8526-11e9-aa30-52543be04c81
            media_content_type: audio/mpeg
            entity_id: media_player."{{this}}"
          metadata:
            title: Limerick 95
            media_class: music
hold_action:
  action: call-service
  service: browser_mod.sequence
  data:
    sequence:
      - service: media_player.media_stop
        data:
          entity_id: media_player.09c70123_bd47d123
        metadata: null
icon: mdi:radio
name: Test
show_state: true

As aforementioned, this does not play anything unless (!) I exchange "{{this}}" in the first sequence with the same entity_id as in the second sequence. Unfortunately, that defies the point, as I wish to have the radio playing on the current device (i.e. not just one that is predefined).

What am I doing wrong? Please help!

Did you find a solution for this?

Guys, i used kios mode before to hide header, now wanted to try browser mode, since kiosk was broken since 2023.4 ā€¦ i hide the header for my browser, even tried to setup as a global setting
But header still present, also after reloading / wiping cache / incognito mode ā€¦
Simple things like changing title have no effect either? What am i missing?

image

ok, seems an general issue:

I just started playing around with browser_mod - hoping to get my camera to pop up upon doorbell. Seems like itā€™s mostly working ok - but just wanted to see if there was a way to shrink the size of the pop up? My camera has a 2k resolution so it takes up a lot of the screen - I would much rather have it take up around about half that size instead.

I tried the following (also have card_mod installed) - but it doesnā€™t seem to let me resize the picture. Have I missed something, or is there a creative workaround if this isnā€™t directly supported?

service: browser_mod.popup
data:
  dismissable: true
  autoclose: false
  title: Amcrest AD410
  size: wide
  timeout: 60000
  content:
    type: picture-glance
    camera_view: live
    entities: []
    camera_image: camera.amcrest_ad410_main
    style: "ha-card { height: 50px; }"

Hello,
I have a problem.
I click on lightsā€“> parterā€“>back and I canā€™t get to the previous window. I tried several options but I still didnā€™t succeed!

type: custom:mushroom-template-card
primary: ''
secondary: Lights
icon: mdi:lightbulb-group
icon_color: orange
layout: vertical
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: Camere
      content:
        type: vertical-stack
        cards:
          - square: false
            columns: 3
            type: grid
            cards:
              - type: custom:mushroom-template-card
                primary: ''
                secondary: Parter
                icon: mdi:lightbulb-group
                icon_color: orange
                layout: vertical
                tap_action:
                  action: fire-dom-event
                  browser_mod:
                    service: browser_mod.popup
                    data:
                      title: Parter
                      content:
                        type: vertical-stack
                        cards:
                          - square: false
                            columns: 2
                            type: grid
                            cards:
                              - type: custom:mushroom-template-card
                                primary: Back
                                icon: mdi:arrow-left
                                tap_action:
                                  action: fire-dom-event
                                  browser_mod:
                                    service: navigate
                                    data:
                                      navigation_path: back
                                      popup: true
                                card_mod: null
                                style: |
                                  ha-card {
                                    width: 140px;
                                    margin-left: auto;
                                    margin-right: auto;
                                    background: rgba(var(--rgb-green), 0.1);
                                    margin-bottom: 12px !important;
                                    }                                          
                                                 
card_mod:
  style: |
    ha-card { 
      background: rgba(var(--rgb-primary-text-color), 0.025);
      width: 66px;
      border-radius: 30px;
      margin-left: auto;
      margin-right: auto;
      margin-top: 4px;
      margin-bottom: -10px;
    }

Return to previous popup Ā· Issue #547 Ā· thomasloven/hass-browser_mod (github.com)

For those, who are on <2.0 browser mod version because of some feature gaps from 2.0 (more-info is closing popup, etc.) and see there popups broken with new HA 2023.4, here my styles for the header to get it better looking back again:

tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    title: Wecker
    style: |
      app-toolbar { display: flex; padding-top: 4px; }
      mwc-icon-button { padding-left: 12px; }
      mwc-icon-button ha-icon { padding-bottom: 6px; }
      .main-title { font-size: 22px; padding-top: 10px; }
    card:

Really great! Thank you so much.
That will help.

Hello,
I have installed the browser_mod custom component and while it works perfectly with any browser, it doesnā€™t work at all with the Home Assistant Android App, it just marks all the entities as "unavailableā€™.
Iā€™m using the latest versions of HA, browser_mod and the android app.
What can I do to get that working?

Where is the problem?
I see only the title.

type: custom:mushroom-template-card
primary: ''
secondary: TV Sufragerie
icon: mdi:television-classic
icon_color: orange
layout: vertical
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      content:
        type: vertical-stack
        cards:
          - square: false
            columns: 1
            type: grid
            cards:
              - type: vertical-stack
                title: TV
                cards:
                  - type: horizontal-stack
                    cards:
                      - show_name: true
                        show_icon: true
                        icon: mdi:power
                        tap_action:
                          action: call-service
                          service: media_player.turn_on
                          service_data:
                            entity_id: media_player.living_room
                        type: button
                        name: 'ON'
                        hold_action:
                          action: none
                        show_state: true
                        card_mod:
                          style: |
                            ha-card:active {
                              box-shadow: 0 0 44px green;
                            }

I have registered the HA Android app on my Samsung tablet an also the browser on my PC with success. I see all sensors and can control screen on/off. But when trying to call a Browser_mod service I canā€™t find any device. Iā€™ve tried to re-register but same error.

Iā€™ve tested Browser_mod before and then it was very straight-forward if I remember correctly. Has anything changed or been broken lately?

I am often getting this series of error:

2023-04-28 13:08:08.702 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.92', 57645)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1168, in get
    data, content_type = await player.async_get_media_image()
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 585, in async_get_media_image
    return await self._async_fetch_image_from_cache(url)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1086, in _async_fetch_image_from_cache
    (content, content_type) = await self._async_fetch_image(url)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1097, in _async_fetch_image
    return await async_fetch_image(_LOGGER, self.hass, url)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1262, in async_fetch_image
    response = await websession.get(url)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.92:57645

The IP address is pointing to my tablet where i configured HA and browser_mod integration.
the media_player.tablet created by that integration is always in unavailable mode and cannot really understand how to make the media player available and how to get rid of those errorsā€¦

Is there any way to disable the media player entity in browser_mod? I have the Fully Kiosk Browser integration which also has a media player on itā€™s own. I donā€™t need two media players on the same tablet.

In the configuration.yaml.
browser_mod:
device:
disable:
- light
- media_player
Itā€™s described in the docs

I would love to find that reference. As far as I know, browser_mod 2 no longer uses configuration.yaml

  • First make sure you have completely removed any installation of Browser Mod 1
    I.e. remove browser_mod: from your configuration.yaml and delete the integration from the integrations page.

Oh sorry. I always forget that. Iā€™m still on 1.5.3
Version 2 doesnā€™t work for me.

I just forgot itā€™s there. I donā€™t use it also, because itā€™s too unreliable in version 2 (it tends to go ā€œunavailableā€ for no reason).
On PCā€™s i use hass.agentā€™s player, on tablets i use rest commands for playback, although fullyā€™s player also works fine.

1 Like