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

Each device registers a sensor called sensor.xxx where XXX is either your alias (if you set one) or your device-ID. One of its attributes is called path and shows which path said device is currently on.

Edit: this might be useful.

Thank you! That was the missing piece I couldnā€™t figure out, now it works :smile:

Somehow, the generated deviceID changed on me. This happened twice on two different devices. I have no idea what I did to cause this. I am using the custom alias to assign a name for the deviceID, but when the underlying generated deviceID changes, the alias does not pair.

To prevent this from happening, I see that I can specify deviceID in the Home Assistant URL. That sounded great butā€¦

I am using the Home Assistant Android App:

  • I went to App Configuration and entered Home Assistant URL: https://mydomain.com/?deviceID=test
  • There is no ā€œsaveā€ button I can see, so I hit the back arrow.
  • I select App Configuration again, and the Home Assistant URL has reverted back to: https://mydomain.com (i.e., with no deviceID)
  • Restarting the App makes no difference.
  • So I cleared the App data and cache, ant reinitialized the App. I.e., it asked for the external URL during startup.
  • Again I entered: https://mydomain.com/?deviceID=test
  • Once initialized and logged in, I went to App Configuration and was disappointed to see it still reverted to: https://mydomain.com (i.e., with no deviceID)

I understand this is not necessarily a browser_mod issue, but I am posting here because I am hoping others here have figured a way to specify deviceID for the Android App.

Is there a way to get the App to preserve the ?deviceID= in the URL?

Is there is another way?

Perhaps someone could try adding deviceID= to the URL in the app and let me know if it fails to persist. At least I would then know it is not something I am doing wrong. :slight_smile:

Thanks!

By quick testing it seems not to stay for me too.

So, it sounds like a bug thenā€¦ Can anyone suggest the correct place to report it? I.e., I guess it is only relevant to the Android App. (I have not tried IOS - donā€™t have any Apple devices).

Unless it is by design, for some reason I donā€™t understandā€¦ If so, perhaps someone can enlighten me, and suggest the way around it. Actually, a way around it would be welcome in any case!

Itā€™s a good feature because it means you donā€™t have to keep track of random generated codes, and you donā€™t have to set up name associations in the HA config file.

I received this reply from an HA dev:

ā€œIn all cases that are accepted into HA core if any integration requires additional information that is either provided in YAML or the config entry. There is no URL modding. For the app itself we use the URL you provide in lots of other places. We use that same URL for the webview and all other communication made to your HA server. We require the base URL and during onboarding it is all that is requested. As this is a custom integration you may want to reach out and request another way to enter the device ID or just use a real browser for it as its also called browser_mod the app itself we are a webview and not really a browser. Regarding hosting elsewhere that is more of a proxy thing and not related to the app to pop-up a username and password. Still not an HA standard.ā€

So it sounds like this behavior is by design. Is there any other way possible to get a user defined deviceID into the browser (now or in the future)?

Iā€™ve just found a solution to the problem with the set_theme service.
It looks like this broke when light/dark mode support was added - Home Assistant expects the selected theme to be an object (like {ā€œthemeā€:ā€œtheme nameā€}) rather than just a string. Changing the service call like this seems to work:

- service: browser_mod.set_theme
  data:
    theme:
      theme: "theme name"
        deviceID:
          - mydevice

Edit: This can also be used to switch between dar/light mode for the ā€œdefaultā€ theme. For example:

- service: browser_mod.set_theme
  data:
    theme:
      theme: "default"
      dark: true # true for dark mode false for light mode
        deviceID:
          - mydevice

You go to ?deviceID=test once, and after that your deviceID will be test.

I think the problem is that this works fine in a regular web browser, but thereā€™s no way to get the mobile app (Android or iOS) to go to that URL. The app doesnā€™t pass the ?deviceID part on if you include it the server URL in the configuration.

iā€™m using HA in kiosk mode but iā€™m not getting an deviceID. I used browser_mode.debug but no ID is created. How do you create an ID?

has this been recognized yet:

browser_mod.js:149:19230 TypeError: undefined is not an object (evaluating 'this._blackout.style')

filling the home-assistant.log

Should be fixed in the current master version (if installed from HACS). Iā€™m not ready to make it a release yet, because I havenā€™t tested it in FKB, but it will be 1.2.0.

Updated to version 1.2.0 and the pop-up titles appears as undefined

4 Likes

Hi all.
Is there a way how to achieve the pop up auto closing after preset time is over?
Example: click on button=>pop up=>30 secs=> pop up closes :slight_smile:

Uups, I see that it is no go. Not in the direct way.

Hi all,

First, i love this custom component very much. I usually use it for pop_up cards.
But i found some errors in the Core logging of HA. My HA is crashing almost everyday. I can ping the RaspberryPi3 but the webinterface is not reachable and i have to reboot it.
So when checking al the errors in the logging i found this. And maybe it has nothing to do with the crash of HA but Iwill fix this error. The error is:

> 2020-10-30 11:11:19 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: browser_mod
> 2020-10-30 11:11:24 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.547697897536] 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 42, in handle_update
>     devices[deviceID].update(msg.get("data", None))
>   File "/config/custom_components/browser_mod/connection.py", line 83, in update
>     self.sensor = self.sensor or create_entity(
>   File "/config/custom_components/browser_mod/helpers.py", line 47, in create_entity
>     adder = hass.data[DOMAIN][DATA_ADDERS][platform]
> KeyError: 'sensor'
> 2020-10-30 11:11:34 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.547697897536] 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 42, in handle_update
>     devices[deviceID].update(msg.get("data", None))
>   File "/config/custom_components/browser_mod/connection.py", line 83, in update
>     self.sensor = self.sensor or create_entity(
>   File "/config/custom_components/browser_mod/helpers.py", line 47, in create_entity
>     adder = hass.data[DOMAIN][DATA_ADDERS][platform]
> KeyError: 'sensor'

I have reinstalled browser_mod ones via HACS.
Have a RaspberryPi3 with HA 0.116.4 with HASSOS 4.15.

I hope someone can help me to fix these errors.

This can be achieved by calling the pop-up in a script then adding this to the sequence

 - delay:
    seconds: 30
 - service: browser_mod.command
   data:
     command: close-popup

Hope this helps

I am confused a bit.

So far I have (on wall panel) following custom:button-card config:

          - type: "custom:button-card"
            template: custom_button_sensor_on_active_glow
            entity: binary_sensor.hydro_mb
            name: Reduction 
            tap_action:
              action: call-service
              service: browser_mod.popup
              service_data:
                deviceID:
                  - this
                title: Hydrolysis
                hide_header: true
                card:
                  type: entities
                  entities:
                  - entity: input_boolean.cover
                    type: custom:multiple-entity-row
                    name: Hydro reduction
                    toggle: true
                    show_state: true
                    state_color: true
                    entities:
                    - entity: input_select.hydro_reduction
                      name: Reduction

If I click to button, it pops up. If I click area out of pop-up, it closes.
I have no clue how to fire a script from it or how to do it anyhow.
Could you push me to the right direction?
Should I call two services i.e. pop-up and script under one tap-action ?

Here is a link to the example using a script -> https://github.com/thomasloven/hass-browser_mod/wiki/Cookbook

Upsā€¦I should read more carefully :slight_smile:
Thank you :+1:

Hello,
in the popup I have a button, clicking it navigates to another view, but I would like that popup will close after clicking.
I canā€™t deal with it, any suggestions?