hass-browser_mod icon indicating copy to clipboard operation
hass-browser_mod copied to clipboard

Run browser_mod.javascript only on device from trigger

Open Rijswijker opened this issue 1 year ago • 3 comments

My Home Assistant version: 2023.12

What I am doing: I share a dashboard on multiple NSPanels containing the Home Assistan companion app. On it, I have hidden the title bar and want to return to the previous page (read subview) using a button in my grid layout.

Now I use a call-service action with the service browser_mod.javascript with the code history.back() This in itself works well, only the action is performed on all NSPanels with the corresponding dashboard. Instead of only on the device where I press the back button.

I have tried, for example, having the device_id filled in dynamically by using BrowserID, self, SELF, this or THIS, but all without the desired result. Leaving the target section away is also no option.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: browser_mod.javascript
  target:
    device_id:
      - SELF
  data:
    code: history.back()
icon: mdi:arrow-left-bold
hold_action:
  action: none

If I enter the real device_id then it does only respond to the corresponding panel, but since I now have to create all dashboards 6 times, it is nicer to be able to share dashboards so that I no longer have repetitive work, and differences in dashboards.

Is there a way to do this?

What I expected to happen: That only the browser on which the action is being triggered responds and not all browsers.

What happened instead: See description

Minimal steps to reproduce: Open two browsers with the same dashboard and preform a javascript service call with history.back() as code.

Error messages from the browser console:

No errors

By replacing the space in the checkboxes ([ ]) with an X below, I indicate that I:

  • [X] Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).

  • [X] Have made sure I am using the latest version of the plugin.

  • [X] Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.

  • [X] Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.

Rijswijker avatar Dec 31 '23 11:12 Rijswijker

Any luck? I'm trying to build an automation whereby an NFC tag is scanned and then that user gets a browsermod navigation to the chore logging page. But you can guess the issue, maybe. How do I get browsermod to only operate for that user!

danielrosehill avatar Mar 29 '24 20:03 danielrosehill

Unfortunately no, I still have to maintain 6 dashboards. 😢

Rijswijker avatar Mar 30 '24 06:03 Rijswijker