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

Can you share your code?

Sure. For this to work you must have purchased copy of Kiosk, because you must enable remote administration and set password. Then create rest command in configuration.yaml:

rest_command:
  kiosk_kitchen_reload:
    url: "http://192.168.x.y:2323/?cmd=loadStartUrl&password=yourpassword."

  kiosk_bedroom_reload:
    url: "http://192.168.x.y:2323/?cmd=loadStartUrl&password=yourpassword"

192.168.x.y is, of course, IP of your tablet. Donā€™t forget to enter passwors you entered in kiosk.

You must create rest command for each tablet you want to be refreshed. After HA restart you can test if it works by copy/paste above url in browser - fully should reload page.

Then in HA create auotmation:

alias: HA restart actions
trigger:
  - platform: homeassistant
    event: start
action:
  - service: frontend.set_theme
    data_template:
      name: AMOLED Blue
  - service: rest_command.kiosk_kitchen_reload
    data: {}
  - service: rest_command.kiosk_bedroom_reload
    data: {}
mode: single

This automation executes after each HA reboot. In this automation i also set desired HA theme.

You can also create automation for kinda automatic refresh when you change lovelave board (so you donā€™t have to press ā€œrefreshā€ each time. Similar automation, only trigger is different:

trigger:
  - platform: event
    event_type: lovelace_updated

EDIT: your can read all rest commands for kiosk HERE. Search for ā€œrest interfaceā€. You can, for example, set volume, start/stop screensaverā€¦ you name itā€¦

1 Like

I LOVE this mod! However, I cannot get aliases to work, no matter what I put into the config my devices never change names. Iā€™m sure Iā€™m just doing something wrong, but it seems like this is the correct setup:

browser_mod:
  prefix: "browser_"
  devices:
    df89da63-efbccb9f:
      name: my_chrome
    4d027c14-d1e728f0:
      name: my_safari
    dc39f0c9-a5b4e5da:
      name: wallmount_keosker

Youā€™re not alone. Iā€™ve been struggling with this as well. I also posted about it above here.

The Github post states that we have to change the DeviceID, but thatā€™s simply a catch 22 because as soon as you change it, it creates a new entity which also cannot be renamed.

1 Like

Is there a way to reduce the size of the pop-up?

I like how the pop-up looks on GitHub (desktop) where you can still see the page behind it, vs on mobile it takes up the entire screen. Not a deal breaker but would be nice if I could reduce the size.

1 Like

Iā€™ve had same problems. But yesterday i tried by adding ā€œignore -allā€ in configruation.yaml. This command causes that no entities will be created by itself, only those which have alias in configuration. It WORKED!
Old entities remained unavailable and i was be able to delede them, while new ones with alias name appeared as soon as i refreshed tablet page. Of course in this case you must set device id with ā€œdeviceID=ā€¦[id, entered in config]ā€ command in start url.
Maybe itā€™s just and ā€˜accidentā€™, but itā€™s worth to try.

Yes, that works
but doesnā€™T it has to be:

devices:
  - xxxxxxxxx:
       name: my name
disable:
  - all

?
In addition I renamed my devices manually one time. Click on the small i symbol,
image
then on the gear in the right upper corner and rename your device.
image

Yes, this is the correct way.
Renaming entities is not the same, because when you rename it then ā€œentitiy idā€ is still, say, media_player.11111111_1111111, just name is as you entered. But if you define aliases then ā€œentity idā€ is: media_player.yourdefinedname

Using pop-up how would I have multiple mushroom cards without running into the ā€œduplicate entryā€ error?

type: custom:mushroom-cover-card
entity: cover.bedroom_shades
name: Daniels
tap_action:
  action: call-service
  service: browser_mod.popup
  data:
    title: Popup example
    card:
      type: custom:mushroom-cover-card
      name: Bedroom Shade 1
      entity: cover.bedroom_shade_1_window_covering
      show_position_control: true
hold_action:
  action: toggle
double_tap_action:
  action: navigate
  navigation_path: shade-more-detail
card_mod:
  style: |
    mushroom-shape-icon {
    --shape-color: none !important; }
    ha-card {
      --ha-card-background: transparent;
      --card-primary-font-size: 14px

Another question on the pop-up service, using the pop-up service call inside of an auto entities is it possible to use a template for the pop-up to remove the word lights and list the light entities that matches/contains the words before it. For example I have it set to include entities with lights in their name because thatā€™s how I assign names for groups. Is it possible to use a template to take light.kitchen_lights for example and search all light domain entities containing kitchen to list in the pop-up entities card Every light has a number light.kitchen_1 for example.

Hello Protoncek
This actually worked just fine, and menu items are now active again after the auto-refresh.
Big thanks !

/Michael

1 Like

How can I get a Popup to display ONLY on the device Iā€™m using?

Iā€™m using the Mushroom Chip card to display the number of lights that are currently on. When I click on that chip I have the action set to Call Service / browser_mod.popup which uses a customer:auto-entry card to display all the lights currently on. All that code is working fine BUT the popup displays on every device running HA.

Iā€™ve done a lot of reading and it seems that I need to put in my code deviceID: [this] but for the life of me, every place I try to put it either doesnā€™t popup at all or still pops up on all devices. Iā€™ve even tried with the implicit deviceID of the device Iā€™m using. Same results.

Can anyone help me with this? Here is my code.

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: sensor.number_of_lights_on
    icon_color: amber
    icon: mdi:lightbulb-group
    tap_action:
      action: call-service
      service: browser_mod.popup
      data:
        title: What Lights are On
        card:
          type: custom:auto-entities
          filter:
            include:
              - domain: light
                state: 'on'
            exclude:
              - domain: light
                attributes:
                  type: browser_mod
              - attributes:
                  entity_id: $$*
          show_empty: true
          card:
            type: entities
            show_header_toggle: true
            title: Turn Off
      target: {}
  - type: entity
    entity: sensor.number_of_doors_open
    icon_color: blue
    icon: mdi:door-open
    tap_action:
      action: call-service
      service: browser_mod.popup
      data:
        title: What Doors are Open
        card:
          type: custom:auto-entities
          filter:
            include:
              - domain: binary_sensor
                attributes:
                  device_class: door
                state: 'on'
          show_empty: true
          card:
            type: entities
            state_color: true
      target: {}
  - type: entity
    entity: sensor.number_of_windows_open
    icon_color: green
    icon: mdi:window-open
    tap_action:
      action: call-service
      service: browser_mod.popup
      data:
        title: What Windows are Open
        card:
          type: custom:auto-entities
          filter:
            include:
              - domain: binary_sensor
                state: 'on'
                attributes:
                  device_class: window
          show_empty: true
          card:
            type: entities
            state_color: true
      target: {}
alignment: justify

i face same issue .

I havenā€™t found a solution.

Displaying popup ONLY on the device youā€™re using.

type: picture
image: https://demo.home-assistant.io/stub_config/t-shirt-promo.png
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    title: Whatever    
    card:
      type: custom:auto-entities
      card:
        type: entities
      filter:
        include:
          - domain: binary_sensor
            state: 'on'
            name: '*Doors*'
hold_action:
  action: none

This is what worked for me

Notice the action type of ā€œfire-dom-eventā€

1 Like

THIS worked. I missed it in the documentation. Thanks.

Does anyone have an issue with pop-ups not working in the companion app when not local.
When I switch to data or a non-local wifi network pop-ups donā€™t work. I tried closing the app and restarting the phone, it doesnā€™t seem to fix it.

However they do work if I open a browser and go to my nabucasa url. So I assume itā€™s something to do with the way the companion app and browser mod interacts potentially with the device id?

I use this format on all pop-ups.

type: custom:mushroom-entity-card
name: Daniels šŸ’”
entity: script.strips_1_and_2_night
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    deviceID:
      - this

Editā€¦
I accidentally hit start conversation and backed out of it causing the loading screen to appear as if I just opened the app and pop-ups began to work. I recreated that twice by going back to wifi reopening the app it worked, going back to data reopening the app it didnā€™t work. Once I hit start conversation and backed out of it forcing a reload, it worked again.

Without any background on how browser_mod works: Sound like switching the connection also updated the DeviceID, which is not updated in Browser_Mod. Therefore the this reference is invalid. Once you release the DeviceID is created/updated again and it works again.

Is there a workaround to this while still only doing a pop-up on the device that requested it?

I wonder if you can set a static device id?

I can add the ?deviceID=mydeviceid to the link in the browser but I canā€™t seem to add it to the companion app it reverts back, I tried clearing app data and starting again it just reverts back everytime.

Per the docs the deviceID can also be set using the browser-player.

It worked for one device to set the deviceID on local and on data. However for 2 other phones on local the browser-player appears and on data it says custom element doesn't exist: browser-player. Does anyone know why that is happening?

Fixed. Had to do a bunch of clear cache. So yes it is possible to set a static device id. I tested it on multiple phones.

The ā€œpathā€ attribute on the sensor does not seem to work any longer.
Has this been removed or changed?

Has anyone ever tried multiple commands with fire-dom-event?
This doesnā€™t work. The docs say using commands works well with fire-dom-event but didnā€™t provide an example of using that.

Command**s** with an **s**. Will call a list of commands consecutively.
This is mostly useful with the fire-dom-event method of calling commands.
- type: custom:mushroom-template-card
  primary: Test HVAC
  icon: mdi:cog
  tap_action:
    action: fire-dom-event
    browser_mod: 
      commands:
        - command: navigate
          navigation_path: /lovelace/hvac-automations
        - command: close_popup