đŸ”č Browser_mod - turn your browser into a controllable device, and a media_player

You need: “action: call-service” after tap_action, before “service: browser_mod.command”.
Not sure why your script won’t work though.

Also, tap_action shouldn’t be a list.

- type: entity-button
    entity: light.family_room
    name: TEST
    tap_action:
        action: call-service
        service: browser_mod.command
        service_data:
          command: blackout
         # deviceID:
         # - 871bd80d-09d34d4a

No pressure, no hassle and certainly no expectation, but can I ask if this is something you might be looking into?

I only ask so that I know whether to re-think my plans or whether to wait and see if there might be a solution.

Thanks.

It sounds to me like the problem isn’t in browser_mod, but that your interface loses its websocket connection to the backend.
Maybe your device goes into some kind of sleep mode?
Maybe your wifi gets disconnected on inactivity to save power?
I’m no expert on the FullyKiosk settings, I just set and forget it more than a year ago


Ok, thanks for the response.
I can believe it is an issue with my tablet. It was cheap one


Can I ask what you use?

The cheapest I could find. Wouldn’t recommend it.

Thank you! My sample works now. I knew I had to be missing something, I just couldn’t find it.

I think my problem was I was trying to piece together a working code without a complete working example. I just submitted a proposed addition to your README that could help.

I am using a script to trigger a browser_mod popup card however when I use

deviceID:
  - this

the popup doesn’t show when called through the script however this does work if I just use it inside say an entity-button in lovelace. If I list the actual devices in the script the popup will show as expected. Is there a reason why the “- this” parameter will not work within a script?

Ultimately when using a device list the popup shows on all connected devices which would be okay if I could get it to close on all devices once it’s closed on one device but they remain open. I also tried adding a close popup step in the script but it did not close all popups once it was closed on one device. I assumed using “- this” would only show it on the device that called it but it doesn’t seem to be working that way, at least in a script. Is there any work around for what I am trying without duplicating the script for each device?

The script is run in the backend, and can’t know from where it was called.

However, there is indeed a workaround for this. Since the latest version browser_mod will replace this with the current deviceID in any service call which has deviceID in its data.
So if you change your script to have

deviceID: {{deviceID}}

and call it from the frontend using

tap_action:
  action: call-service
  service: script.my_script
  service_data:
    deviceID: [this]

it should work.

Is this the correct syntax for the script? Or is that suppose to be a list of the various device_id’s

- service: browser_mod.command
  data:
    command: popup
    deviceID: {{deviceID}}

I am receiving this message:
Error loading /config/configuration.yaml: invalid key: “OrderedDict([(‘deviceID’, None)])”
in “/config/script/script.yaml”,

Ah yes, sorry. You need to replace data with data_template for that to work, I believe.

hmmm, same error message
*edit - I got past the error message by adding single quotes deviceID: ‘{{deviceID}}’
Unfortunately it didn’t make a difference. The popup still appears on all devices.

Ah. Qoutes!

deviceID: "{{ deviceID }}"

Does this need quotes too? - > deviceID: [this]

Actually, this isn’t working the way I expected. Let me get back to you


Ok. Now I’ve thought it through.

What you need in your script is

data_template:
  command: popup
  deviceID: ["{{ ','.join(deviceID) }}"]
  title: ...etc...

Unfortunately now the popup is not appearing.

  • Edit - just to add some clarification. The first part of the script runs because the prior popup closes but the new popup doesn’t show.
set_alarm_time_popup:
  alias: Set Alarm Time Popup
  sequence:
    - service: browser_mod.command
      data:
        command: close-popup
    - service: browser_mod.command
      data_template:
        command: popup
        deviceID: ["{{ ','.join(deviceID) }}"]

Tested and working: https://github.com/thomasloven/hass-browser_mod/wiki/Cookbook#displaying-a-popup-via-a-script

It seems the script is not executing this time because the prior popup is not closing now. Is version 11 the latest of the browser_mod? Not sure what is different and why it’s not working.

(*Edit - after thinking about it the script maybe is called but the deviceID isn’t being passed?? so the script doesn’t execute?? Not sure how to determine if the deviceID is being passed to the script.)

Script:

set_alarm_time_popup:
  alias: Set Alarm Time Popup
  sequence:
    - service: browser_mod.command
      data_template:
        command: close-popup
        deviceID: ["{{ ','.join(deviceID) }}"]
    - service: browser_mod.command
      data_template:
        command: popup
        deviceID: ["{{ ','.join(deviceID) }}"]

Calling Script
- type: entity-button
  entity: script.set_alarm_time_popup
  name: Change Alarm Time
  icon: mdi:sleep
  tap_action:
    action: call-service
    service: script.set_alarm_time_popup
    service_data:
      deviceID:
        - this

I tried removing the brackets and the script ran but I was back to having the popup show on all devices. Thoroughly stumped why it’s not working and it seems to match your example.