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

Total guess here because I donā€™t use IPhones.
I know that devices have started using randomized Mac addresses for wifi and BT. This has created a lot of issues for home automation that relies on Mac addresses. On my Samsung phone there is an option to disable the randomized Mac (per network). I disabled it on my home network so that my phone does not constantly pull a dhcp ip instead of my reserved one.

Again, not sure if this is even related to how browser mod assigns its device idā€™s but thought Iā€™d throw it out there anyway.

The device ID uses browser local storage, but there is a know issue with ios devices clearing it occasionally: https://stackoverflow.com/questions/15114571/is-localstorage-on-ipad-safari-guaranteed-to-be-persistent

If no deviceID is found, a new random one is generated. Unfortunately, to my knowledge thereā€™s no better way to do it because in general browser users donā€™t want their browsers/computers to be uniquely identifiable.

I was just debugging this to find out how the device ID was created. This saves me some time, thanks. Looks like Iā€™ll need to create the app to dynamically find my device then. It appears to reset every few days.

please share if you find a wayā€¦ It bugs my intercom system regularly
it also seems to change when clicking the reset frontend in the App?

another warning:
the latest update of browser-mod isnt compatible with 109.6ā€¦? I am aware of the release title: Fixes for up to 0.100.0 and dlā€™ed release 27 after that, but wrongly concluded that doesnā€™t mean it should only be used from 110 on.

2 Likes

I plan on creating a appdaemon app that creates a static sensor that mirrors any found browser_mod sensor.

The plan is to:

  1. Search all sensors that have browser_ in the object_id.
  2. find matching userid and currentUser.
  3. Mirror the first found sensor exactly.

It might have a heavy load on a bad system though.

As a side note, this functionality might make a good feature request for the disable area in browser_mod. Something like

devices:
- filter:
    userAgent: iPhone
    user: petro
- filter:
    userAgent: iPhone
    user: wife
- 99980b13-dabc9563:
    name: arrakis
- d2fc860c-16379d23:
    name: dashboard
disable:
- all

I am confronted with a completely different issue now:
after my install of release 27, I just went back to 25, and all seems well. I can even see the auto-entities config of media players show my iPhone when I push a message to it, and the iPhone shows its device_id correctly, which of course I have setup in configuration.yaml for browser_mod devices

I am unable though to hear itā€¦ volumes up, side-switch is on, and no error message in the log.

any thoughts I could try?

nevermind
sound came back miraculously ā€¦

This was asked long time ago, but as far as Iā€™ve seen there was no solution am I right?

the only way is to configure your logbook to only output what you want. I.e. maintain an included list. Everything else will be excluded.

would be another great FR, (do even think I filed that some time ago) of being able to glob in recorder:

include:
  media_player.browser*
exclude:
  light.browser*

Apple - in its infinite wisdom - has made it so that you canā€™t play sounds from websites on iOS without the user allowing it. The way you ā€œallowā€ it for browser mod is by touching the screen. This needs to be done once every time you refresh the page.

thanks, and yes, I was aware of that, so kept touching my screen :wink: It is a major nuisance, because it makes it no very useful for a closed browser/app (which is when regular notifications are needed) would be nice if we could somehow wakeup the phone, fake a touch, and receive system message like that.

Anyways, it seems to be working again.

May I ask another thing, which has been on my list for a long time:
During startup it takes a very long time for the browser_mod domain to be initialized

2020-05-22 17:19:11 INFO (MainThread) [homeassistant.setup] Setup of domain browser_mod took 155.7 seconds.

Only thing I could link this to is the domain sensor, which also takes long and is logged just before that:

2020-05-22 17:17:26 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.0 seconds.
2020-05-22 17:19:09 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 147.1 seconds.
2020-05-22 17:19:11 INFO (MainThread) [homeassistant.setup] Setting up camera
2020-05-22 17:19:11 INFO (MainThread) [homeassistant.setup] Setup of domain camera took 0.4 seconds.
2020-05-22 17:19:11 INFO (MainThread) [homeassistant.setup] Setup of domain browser_mod took 155.7 seconds.

Is there an explanation for this long time, and are they connected?
thanks for having a look if you would,

How do I resolve these errors?

2020-05-22 08:20:09 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform browser_mod.media_player: Platform not found (cannot import name 'MediaPlayerEntity' from 'homeassistant.components.media_player' (/usr/src/homeassistant/homeassistant/components/media_player/__init__.py)).
2020-05-22 08:20:15 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform browser_mod.light: Platform not found (cannot import name 'LightEntity' from 'homeassistant.components.light' (/usr/src/homeassistant/homeassistant/components/light/__init__.py)).

2020-05-22 08:20:25 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.22855283204560] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
    handler(self.hass, self, schema(msg))
  File "/config/custom_components/browser_mod/connection.py", line 36, in handle_update
    devices[deviceID].update(msg.get("data", None))
  File "/config/custom_components/browser_mod/connection.py", line 85, in update
    self)
  File "/config/custom_components/browser_mod/helpers.py", line 30, in create_entity
    adder = hass.data[DOMAIN][DATA_ADDERS][platform]
KeyError: 'media_player'

It happened to me when I upgraded browser_mod to 27, but still using 0.109.6 for HA.
As far as I can understand what is working is HA 0.109.6 + BM (up to) 25, HA 0.110.x + BM 27

So downgrade browser_mod, or upgrade HA :slight_smile:

GV

PS: In my case, I chose downgrade BM. There are some changes in 110 that breaks some of my stuff

How can I add a little margin at the bottom of the popup?
image

Edit: found it! I just added margin-bottom to the card containing the icon :slight_smile:

Quick question - is it possible to combine the use of deviceid: this, an MQTT publish and a browser_mod.navigate all in one lovelace tap action? I think not but this might be my lack of imagination. I wanted to be able to (with one tap action from a wall tablet) change the lovelace view on the device in question and simultaneously publish an MQTT message. I havenā€™t found all of this to be doable yet with one tap. Thanks

Put everything you want to do in a script. Tap action set to call-service. Service is the script (scripts are services).

1 Like

aha - then it sounds like itā€™s doable - but my problem is how to use ā€˜deviceID: thisā€™ from a script. I tried putting it in the script but it doesnā€™t work - I gather I need to somehow incorporate it into the lovelace? Iā€™m sadly totally unaware how to do that. I am currently using scripts you see but it sounds like Iā€™m doing it wrong.

Hello; i am trying to user the below for a camera pop-up, which works - butā€¦ Is there a way i can add a title to this?

command: more-info
entity_id: camera.blueiris_maindoor

Thereā€™s an example in the cookbook linked from the readme. You provide deviceID to the script via the service call, and then use it as a jinja template variabel in the script.

Problem with browser-player card in Browser_mod. First, the browser_mod is fantastic, I now use it all the time. However, I have a problem with its browser-player card. It shows up in all my devices with the appropriate IDs as it should. However, the volume slider simply doesnā€™t do anything, it doesnā€™t control the sound volume on any of the devices. Is there more to it than simply adding it as a card:

  • type: ā€˜custom:browser-playerā€™

Many thanks for any input.