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


:man_shrugging:

Hello guys, just found out this awesome custom component! Thanks a lot for the developement :slight_smile:
Iā€™m trying to achieve something with HA.
I want my automations to be able to automatically play/ pause any media that is playing in chrome browser on my PC, so that I can pause youtube video if I get a phone call for example :slight_smile:
Iā€™ve tried the media component of this custom component, unfortunately it doesnā€™t seem to be able to control media on other chrome pages? Do you think I might have setup something wrong?

A nice feature of chrome browser is this button:
image
Thanks

Thatā€™s not possible with browser_mod.
The browse_mod player is just an audio player running in the Home Assistant frontend. It canā€™t control other things on your computer.

Firt of all, Thanks for making this awesome component.

iā€™m trying to get the popup card working. followed the instructions on github and at a moment it worked. But then i changed something in the card config and now i canā€™t get it back to work.
iā€™m definetly missing something in the config.

this is my card config.

aspect_ratio: 4/1
entity: media_player.spotify
name: Play Spotify
tap_action:
  action: call-service
  service: browser_mod.popup
  service_data:
    card:
      - cards:
          - entities:
              - entity: input_select.spotify_playlist
              - entity: input_select.spotify_speakers
            title: Spotify Test Card
            type: entities
          - aspect_ratio: 4/1
            entity: script.spotify
            icon: 'mdi:spotify'
            tap_action:
              action: call-service
              service: script.spotify
            type: 'custom:button-card'
          - conditions:
              - entity: media_player.spotify
                state_not: idle
            type: conditional
          - card:
              artwork: full-cover
              entity: media_player.spotify
              hide:
                controls: false
                power: false
                progress: false
                source: true
                volume: false
              info: scroll
              style: ''
              tap_action:
                action: more-info
              type: 'custom:mini-media-player'
        type: 'custom:stack-in-card'
    title: Spotify player
    deviceID:
      - this
      - dashboard
type: 'custom:button-card'

It is based on this:

aspect_ratio: 4/1
entity: media_player.spotify
name: Play Spotify
tap_action:
  action: call-service
  service: browser_mod.popup
  service_data:
    card:
      entities:
        - light.bed_light
        - light.kitchen_lights
        - light.ceiling_lights
      type: entities
    deviceID:
      - this
      - dashboard
    title: Popup example
type: 'custom:button-card'

Which is also not working.

can someone help me to check the code?

I think the answer is no but can you use browser mod with a google home hub to turn the hub to home assistant when motion is detected? I canā€™t seem to see the hub as a binary sensor but have the others which is why Iā€™m thinking it might be noā€¦

Hi Thomas - does this DEFINITELY work? Because now it turns out itā€™s not just me - thereā€™s another chap who never managed to get it to work either. Just wondering. LOVE the card and what you do but just wondering if thereā€™s maybe an undetected bug here? :slight_smile: :slight_smile:

I donā€™t use browser_mod myself, and havenā€™t actually tested it for a very long time.
Itā€™s quite possible that something has broken about the hack that makes - this work.

You could try deviceID: this instead, until I have time to fix it. Thatā€™s a bit more stable.

Can someone who is using fully kiosk browser try something for me?

Iā€™m solving for a discrepancy between the deviceID shown within fully kiosk browser and what is shown in my Home Assistant configuration.

When I clear cache on my fully kiosk browser the device id changes in Home Assistant. It remains the same in fully kiosk browser.

This is a problem as I have to restart Home Assistant to capture the new device alias whenever I clear cache on the device.

I can duplicate this personally on amazon FireOS, LineageOS both with fully kiosk browser installed.

The deviceID is shown in fully kiosk browser here
Settings / Other Settings / Device ID

thank you

One of the android app on a tablet doesnā€™t seem to be working. When I do browser_mod.debug from the developer tools from my PC browser, my PC browser and mobile phone (android app) will get a popup with the device ID.However on the tablet (android app) nothing is popping up. When I go into the developer tool on the tablet (Android App), and do browser_mod.debug it will cause the popup to showup on every other device except for the tablet. Iā€™ve tried reinstalling the app, clearing the cache and data but nothing seems to be working.

The only working thing is that if I use a browser(firefox) on the tablet will I see a popup.

Other notes: Android app is using the most up to date app, Tablet android OS: Android 7.1.1

Does anyone have any solution to the problem of the android app not showing a device id popup when I do browser_mod.debug ?

Thanks!

This tablet did not have chrome browser installed, which made the app not work with browser_mod. After enabling it I can see the deviceID now.

Does anyone know how you first CHECK the current path before ā€˜navigatingā€™ ? I know how to read the path

{{ state_attr('sensor.7d8111b8_a8211111', 'path') }}

but I donā€™t know how to assess/compare in a template/condition

thanks!

https://jinja.palletsprojects.com/en/2.11.x/templates/#if

Sorted - thanks

{{ is_state_attr('sensor.7d8111b8_a8211111', 'path', '/lovelace/6') }}

I am still struggling with the device id displayed in fully kiosk browser being different to the device id for it shown in Home Assistant. When I clear the cache on fully kiosk browser the device id changes within Home Assistant. Does anyone else have this problem?

1 Like

Is there a way to have a popup card close automatically after seconds of no activity.

Use case is Iā€™m using popup-light-card to dim lights, if the popup is left open and thereā€™s been no activity on the popup Iā€™d like to automatically close it.

Thanks!

Sure, check the documentation about popups: :slight_smile:

Thanks, I read the docs, but no. The time parameter pops up a card after a set time, which is cool, but not what Iā€™m trying to do. Iā€™m trying to close a popped up card after seconds of no mouse/tap activity. Hereā€™s the config I tried:

                        action: call-service
                        service: browser_mod.popup
                        service_data:
                          title: Popup
                          deviceID: this
                          auto_close: true
                          time: 1

Also, using auto_close is the opposite of what Iā€™m trying to achieve.

Thereā€™s no way of acomplishing this with browser_mod alone. You can send a browser_mod.close_popup command from the backend after a set time, and keep track of interactions some other way.

I working on a PR right now. Something such as autoclose_popup_card: <time>. Doesnā€™t seem too hardā€¦ but Iā€™m less experienced at JS.

this is a great mod! at least I can see the potential for my use case.

Iā€™d like to play a sound on all the clients that are connected to HA lovelace (with browser_mod running) using the HA REST API

At the moment I have:
curl -X POST -H ā€œAuthorization: Bearer xxxxxā€ -H ā€œContent-Type: application/jsonā€ -d ā€œ{ā€œentity_idā€: ā€œmedia_player.xxxxxxxxxxxxxxā€}ā€ http://xxx.xxx.xxx.xxx:8123/api/services/media_player/media_play

which works great for 1 single connected client.

How can I, with a single http request, play a sound on all clients that are connected?

To target all media players, use all .