How can I run a script while (either right before or after) "popping up" a window with browser mod?

Here’s my use case. I have a dashboard design for tables with a button (custom button card) that shows the sonos player card as a popup using browser mod. This dashboard has separate pages for each room in the house (tables in each room set to the appropriate page) Sometimes all of the sonos speakers are joined together, sometimes I want them separate. When i tap the “music” button in a particular room, say the bedroom, I want to be able to run a script to “unjoin” the bedroom sonos speaker. I’m not worried about a generic solution that would handle the different rooms/pages. I will simply create different scripts to unjoin each sonos speaker, and call the appropriate script from each button. I think the 2 options are A) find a way to invoke the script on the tap_action of the button, but then also display the popup (just on that table, not all of them) or B) find a way to invoke the script when the popup window loads. Any thoughts on how to accomplish this, or other suggestions?

Thanks!

Hi Andrew,

there’s a service browser_mod.sequence

Paste the following into Developer Tools/Services and adjust the entities:


service: browser_mod.sequence
data:
  sequence:
    - service: script.xxxx
    - service: browser_mod.popup
      data:
        title: Popup
        content:
          type: vertical-stack
          cards:
          - type: entities
            entities:
            - entity: media_player.xxxx

2 Likes

Thanks @pedolsky !