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

Thank you for your detailed response! Unfortunately all my wall mounted devices are iPadsā€¦

I have discovered auto-reload-card which allows Lovelace to refresh every x minutes. Not an ideal solution but will give it a try.

It would be really interesting to know if this is a bug or if itā€™s something that canā€™t be avoided due to the way browser_mod communicates with HA @thomasloven

Is it not possible to use directly the service, given from browsermod? Lovelace_reload and window_reload?

Unfortunately not after restarting HA. All devices show as unavailable until they are manually refreshed :frowning:

When they are connected, browser_mod commands work as normal.

Does anyone has a simple example of a button which would start playing radio station (from radio browser) on the pc/tablet/phone. I am struggling quite a bit. When I wanted to select the browser media player in automation creation (virtual switch is the trigger) it says ā€œmedia player does not support browsing mediaā€ so this is the action I want to run when I press a virtual switch. Any Ideas why this is not working? Thanks

service: media_player.play_media
target:
  entity_id: media_player.a80c6286_2ae38bf8
data:
  media_content_id: media-source://radio_browser/6102cd54-7b35-48f7-863e-4e99732494a7
  media_content_type: audio/mpeg
metadata:
  title: 105.7 Radio Metro
  thumbnail: https://radiometro.com.au/templates/rt_plethora/favicon.ico
  media_class: music
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: app
      media_content_id: media-source://radio_browser
    - media_content_type: music
      media_content_id: media-source://radio_browser/country/AU

Itā€™s funny, because if I run the action it says ā€œplayingā€ but no sound out of speakers. If I play the same station from media ->radio browser (web browser selected as output (bottom right corner)) i hear the soundā€¦
firefox_lkvVo5Iz8O
@thomasloven

After some time I managed to make it work with copying code from commit ā€œAdded media source supportā€ (file media_player.py). So it turns out I was doing everything right, just the browser_mod is not yet updated to work with hass 2022.4 (i guess).
So if anyone else is struggling here lies the solution:

However. I still canā€™t change the volume. I can play, mute, stop the mediaā€¦but volume control does not work (at least not on the ipad).

1 Like

Is this broken atm?

Been 2 days trying to get a simple script to just change dashboard when run. Been messing with every suggestion/format/syntax ive seen in the FAQ and on here and nothing works.

Then noticed this morning the browser entities were all ā€˜unavailableā€™. Removed it all and put it all back , browsers detected again. Started testing with no avail and just checked and they are ā€˜unavailableā€™ again.

Hey,

not sure what Iā€™m doing wrong but I cannot install browser_mod
image

I followed the instructions, created a folder in my custom_components forlder named browser_mod. In there I inserted all the files from custom_components/browser_mod/ in GitHub.

Not sure why I got that error, does anyone have a solution for this?

I see there was an update to this yesterdayā€¦and now appears to work :slight_smile:

Iā€™ve been using Browser_mod for a good long while now and love it - I have a small issue however, I like to keep a remote pc running with a Home Assistant browser window open. After an hour or so this seems to cause the media_player to become unavailable. I got round this by running a .bat file to close and re-launch the chrome tab.

Iā€™ve since moved to a RPI4 and having the timeout/unavailable issue - is there a way to edit this?

1 Like

I installed for the first time and after adding ā€˜browser_mod:ā€™ to the configuration.yaml, I do see the integration browser_mod. But no entities are being created.

Is there a bug or did I miss something? I assume I do not need to copy the contents of custom_components/browser_mod/ to /custom_components/browser_mod/ as I installed via HACS, correct?

Assuming youā€™ve restarted Home Assistant, that is correct. Installing via HACS is usually sufficient. You should be able to see all the files in your custom components folder in any case.

Media player and sensor entities should be created for whichever device you use to access HA, but you will have to actually open HA on your devices first to trigger this.

Unless youā€™ve explicitly disabled this in your configuration yaml? What do you see if you go Developer Tools ā†’ States, and filter by ā€˜media_playerā€™?

Hello Chris,
thank you for your reply. I re-checked everything and all was setup correctly. I had rebooted a few times.

In the end I uninstalled via HACS, deleted from configuration.yaml and started fresh.
This time it worked :slight_smile:

Am I understanding the github readme correctly in assuming that the device_id is not really reproducable? So if I setup a fresh Home Assistant installation, would the same device using the same app (chrome, companion or whatever) always create a new device_id? Or is the device_id always the same for a given combination of hardware and software?

Huh? There isnā€™t anything in there that describes how to actually pull this off. What was your solution?

Glad to hear you got it working, but these inexplicable solutions are kind of infuriating arenā€™t they?

In my experience, device_id remains consistent for specific combinations of device + browser, and will survive logouts, restarts, app updates and so on. Iā€™ve never had to change my config.yaml once a device is set up. I exclude most by default, and have 6-7 selected that I need this to work on.

To be fair, Iā€™ve only used this for: Firefox + Windows 10; Fully Kiosk Browser on Google Pixel Phones (various versions of Android); and the HA Android App on different versions of Android.

Iā€™ve seen reports of losing device_id on iOS devices for example, but obviously this is outside my experience, so can only go on what Iā€™ve seen. Hope this helps.

Most definitely, but this is my overall experience with everything that has to do with dashboards (lovelace). If it werenā€™t for this awesome community (both forum membersā€™ help as well as community/forum membersā€™ custom cards) I would probably have given up on ever creating a nice dashboard.

I read that the iOS problem is linked to iOS creating false MAC adresses but that this can be deactivated and the problem should then no longer occur. I will give it a try with entering all the devices in my configuration.yaml and maybe then do a few uninstall/reinstall and re-configuration tests.

I use customized url for all my permanent devices (home tablets), so they have always same deviceID:
http://192.168.x.y:8123?deviceID=11111111-11111111
http://192.168.x.y:8123?deviceID=22222222-22222222
etcā€¦ numbers are just an example, you can have anything you want, as long itā€™s ā€œ8 chars-8 charsā€ (hex format, so 0-9 and a-f).
This way you tell your device at very start which deviceID it will have.

1 Like

Little surprised no one else has mentioned this since its an issue on the github site, but is there a workaround to sensors no longer working after this last Home Assistant update? All my sensors are now blank. No attributes listed for anything. I was relying on this to pull the current path being displayed for various wall mounted dash boards.

Hi,

I actually just replaced the contents of ā€œmedia_player.pyā€ with the code of gadgetchnnelā€¦ Anyway in the meantime the author (@thomasloven) has created an update for the browser_mod, so I think he merged that commit, and it should work now without the hustle i went through.

Hi,

Iā€™m using the dom event inside the custom button card. Some when in the last two weeks it just stopped working and I was not able to get it back to work again.
I downgraded browser mod in HACS until 1.4 - and it didnā€™t help. Today I restored a backup from beginning of April as a test: there it works, after upgrading HASS core it didnā€™t anymore. there is just no popup.

Maybe I missed something in the configuration (I did not change anything here since it was working):

aspect_ratio: 1/1
custom_fields:
  act_val: |
    [[[
      return `<ha-icon
        style="width: 12px; height: 12px; color: yellow;">
        </ha-icon><span>${entity.state}Ā°C</span>`
    ]]]
  max_val: |
    [[[
      return `<ha-icon
        icon="mdi:pan-top-left"
        style="width: 12px; height: 12px; color: deepskyblue;">
        </ha-icon><span>Max: <span style="color: var(--text-color-sensor);">${states['sensor.balcony_temperature_max'].state}Ā°C</span></span>`
    ]]]
  min_val: |
    [[[
      return `<ha-icon
        icon="mdi:pan-bottom-left"
        style="width: 12px; height: 12px; color: deepskyblue;">
        </ha-icon><span>Min:&nbsp; <span style="color: var(--text-color-sensor);">${states['sensor.balcony_temperature_min'].state}Ā°C</span></span>`
    ]]]
entity: sensor.balcony_01_temperature
icon: mdi:thermometer
name: Temperature outside
styles:
  card: null
  custom_fields:
    act_val:
      - align-self: start
      - justify-self: end
    max_val:
      - padding-bottom: 2px
      - align-self: middle
      - justify-self: start
      - '--text-color-sensor': |-
          [[[ 
            if (states["sensor.balcony_temperature_max"].state <= 3) return 'lightblue';
            if (states["sensor.balcony_temperature_max"].state >= 18 && states["sensor.balcony_temperature_max"].state < 25) return 'lime';
            if (states["sensor.balcony_temperature_max"].state >= 25 && states["sensor.balcony_temperature_max"].state < 30) return 'yellow';
            if (states["sensor.balcony_temperature_max"].state >= 30 && states["sensor.balcony_temperature_max"].state < 33) return 'orange';
            if (states["sensor.balcony_temperature_max"].state >= 33 ) return 'red';
          ]]]
    min_val:
      - align-self: middle
      - justify-self: start
      - '--text-color-sensor': |-
          [[[ 
            if (states["sensor.balcony_temperature_min"].state <= 3) return 'lightblue';
            if (states["sensor.balcony_temperature_min"].state >= 18 && states["sensor.balcony_temperature_min"].state < 25) return 'lime';
            if (states["sensor.balcony_temperature_min"].state >= 25 && states["sensor.balcony_temperature_min"].state < 30) return 'yellow';
            if (states["sensor.balcony_temperature_min"].state >= 30 && states["sensor.balcony_temperature_min"].state < 33) return 'orange';
            if (states["sensor.balcony_temperature_min"].state >= 33 ) return 'red';
          ]]]
  grid:
    - grid-template-areas: '"i act_val" "n n" "max_val max_val" "min_val min_val"'
    - grid-template-columns: 1fr 1fr
    - grid-template-rows: 1fr min-content min-content min-content min-content
  icon:
    - color: |
        [[[
          if (entity.state <= 3) return 'lightblue';
          if (entity.state >= 18 && entity.state < 25) return 'lime';
          if (entity.state >= 25 && entity.state < 30) return 'yellow';
          if (entity.state >= 30 && entity.state < 33) return 'orange';
          if (entity.state >= 33 ) return 'red';
          else return 'white';
        ]]]
    - width: 70%
    - margin-top: '-10%'
  img_cell:
    - justify-content: start
    - align-items: start
    - margin: none
  name:
    - font-weight: bold
    - font-size: 13px
    - color: white
    - align-self: middle
    - justify-self: start
    - padding-bottom: 4px
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    large: false
    hide_header: false
    card:
      cards:
        - entities:
            - entity: sensor.balcony_01_temperature
          hours_to_show: 336
          refresh_interval: 0
          title: 2 weeks
          type: history-graph
        - entities:
            - aggregate_func: max
              color: null
              entity: sensor.balcony_01_temperature
              name: Max
            - aggregate_func: min
              entity: sensor.balcony_01_temperature
              name: Min
            - aggregate_func: avg
              color: green
              entity: sensor.balcony_01_temperature
              name: Avg
          group_by: date
          hours_to_show: 336
          name: Daily (last 2 weeks)
          type: custom:mini-graph-card
      type: vertical-stack
    deviceID:
      - this
    title: Temperature Outside
type: custom:button-card

At least this example is working here. Have just tested it. Only change was, that I replaced every entity with sun.sun.

Perhaps you can try this, if this is related to any entity-JS you are using. Otherwise this problem is not related to this card, but perhaps to your browser_mod installation in general.