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

Hi there,
great work here! I am trying to play a sound to the current browser when hitting a button in floorplan. This code works for a static device name:

- name: Show Crew 2
          entities:
            - input_boolean.crew
          action:
            domain: media_player
            service: play_media
            data:
              entity_id: media_player.tablet
              media_content_id: "http://192.168.178.2:8123/local/sounds/213.ogg"
              media_content_type: 'music'

However, I want to play it not on a specific device, but on the current (this) device like this:

entity_id: media_player."{{deviceID}}"

or

entity_id: media_player."{{this}}"

Tried both, didnā€™t work. So, how could I get the current device id in this setup? Thanks!

Btw.: I would opt for a feature that avoids regenerating device IDs for the same browser of the same MAC device as turning on and off a device makes the naming option useless. Thanks.

1 Like

Youā€™d need a script as an intermediate step, like in this example in the cookbook: https://github.com/thomasloven/hass-browser_mod/wiki/Cookbook#displaying-a-popup-via-a-script

Hi Thomas,

In my setup I have a camera (or more) assigned to each room and tab for each room in HA. I am using stream to relay the live camera image and I have successfully got audio to cast to icecast 2 and then through to various deviceIDs using your wonderful browser_mod. Now I want to extend it to other IP cameras, so I have a separate icecast stream for each IP camera. However, If I start the audio stream and I then change tabs the audio continues to play. Is there a way of stopping the stream when thereā€™s a tab change?

Thank you

Hey Thomas,
thanks for your answer and I followed the example. Unfortunately, I still get on all connected devices a sound. Here is my implementation for the floorplan.yaml (think not interesting here):

- name: Show Life Support 2
  entities:
    - input_boolean.lifesupport
      action:
        domain: script
        service: play_sound

And here is my scripts.yaml file:

play_sound:
  sequence:
  - data_template:
    service: media_player.play_media
      deviceID:
        - this
      media_content_id: http://192.168.178.2:8123/local/sounds/213.ogg
      media_content_type: music

So, it should play only on the device that is triggering the state change, right? But, the sound plays on all devices. Thanks again for your help!

I think you misunderstand how this works.
The whole point of it existing is that the backend (i.e. the computer you run HA on, and where the script runs) canā€™t know from which device you clicked the thing to make the sound play.

The only thing that can know that is your browser. So browser_mod makes your browser replace deviceID: this with itā€™s own device ID whenever it sees it.

Therefore, deviceID: this belongs in the frontend configuration (ui-lovelace.yaml) - where you configure what your browser displays and does.

Look at the example again, and youā€™ll see itā€™s a bit different from yours.

Ahh, I believe I understand you now. So, ā€œthisā€ does not tell me from where a request was coming, but gives me information about the device on which it is applied right now. Then, it totally makes sense that the sound is played everywhere. Uhh, this makes the whole thing a bit trickyā€¦ maybe I would need a different user per device and would need to send the current user to the play script and play it only for devices with the same user. Sounds a bit overkill, but maybe the only solution.

Thanks again Thomas!

Hi
I have the same problem as @bishop? Did you solved it?

Iā€™ve tried to set up my camera with the latest version of browser_mod, but I cannot get it to work. I have a tablet under FullyKiosk (pro) and it appears fine in my sensors (I can control the screen and so on). I added the camera: true in my config restarted HA and clearer the cache of Fully Kiosk on my tablet but when the page reload I do not have a pop up to ask me to give permission to access the camera as your documentation said I should.

For fully kiosk I recommend not using camera: true. The built in functionality is better in every way.

1 Like

Hello,
I havenā€™t spent much time looking into it so itā€™s still not working for me. Iā€™ll try with the built in functionality as advised when I have some time.

Hey @thomasloven ok.
What do you mean be ā€œbuilt in functionalityā€ how to enable that.

In the mean time I got it to work by using another solution from the deprecated
lovelace-fullykiosk https://github.com/thomasloven/lovelace-fullykiosk#camera.

Hi All,

I have still problems with Fully Kiosk and use it as a media player. When I keep the agent to default the stream I send to it will stop after 30 seconds. When I change the agent to chrome or internet explorer (fake agent) then media player is working correct. But then when selecting tabs of HA it takes so long before they appearā€¦ Moving back then its working again, but then the 30 seconds media player problem is back

Thatā€™s the one. The camera function thatā€™s built in to Fully Kiosk.

Iā€™m using this card for popups. The popup works fine, but on mobile when I press back button to close the popup it goes to the previous page instead of closing the popup. Home assistant Builtin popups work great, maybe this is something possible to fix?

Thanks :slight_smile:

Hi
Is it posible to get deviceID: ā€œthisā€ to work in NodeRed.
I am trying to do some actionable notifications where the service should navigate to a lovelace tab on the device that are using the notification.

{
ā€œnavigation_pathā€: ā€œ/lovelace/1ā€,
ā€œdeviceIDā€: ā€œthisā€
}

The feature works by replacing deviceID: this with deviceID: 12345678-90abcdef in any service call made from the frontend.

I donā€™t know what youā€™re trying to do or how NR works, but I assume NR is somehow listening for a service call, and in that case it should see deviceID: 12345678-90abcdef.

What a powerful tool. I have a an android tablet (a ā€œHudl 2ā€) that is working quite well with browser_mod and the pro version of fully_kiosk.

As for a couple of comments above - the camera isnt working for me - I dont want it for motion detection but as a convenient remote view.

I haveā€¦

browser_mod:
  prefix: "browser_"
  devices:
    73251250-6fb9374d:
      camera: true
      name: browser_hudl

I get the media_player, light and sensor - but not the binary_sensor. And the sensor doesnā€™t show as fully_kioskā€¦

type: browser_mod
last_seen: 2020-01-13T12:21:50.075443
deviceID: 73251250-6fb9374d
path: /lovelace/main_view
visibility: hidden
userAgent: Mozilla/5.0 (Linux; Android 5.1; Hudl 2 Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.116 Safari/537.36
currentUser: Dean Smith
width: 960
height: 600

The camera does work using the generic/web page explicit definition. The remote admin for fully_kiosk showsā€¦

Fully version	1.36.1
Android version	5.1 (SDK 22)
Webview version	79.0.3945.116

Its clearly an old Android version (due to age of tablet) - would this have an impact ?
(Edit: browser_mod ver 15 installed via HACS)

How do I delete device_id's that are no longer available if the browser_mod entities arenā€™t stored to core.entity_registry? I donā€™t have any entries in my SQL database after running the below sql either but the unavailable browser_mod entities continue to appear in the states developer tools.

SELECT * FROM states WHERE entity_id LIKE 'browser%';

Ok, maybe itā€™s because NodeRed doesnt allow this then, if it only works from the frontend.

:man_shrugging: Restart?