Need help with a browser mod entity script service

so i use browser mod… and havent touched things in several years
i just added a script but the button doesnt work… if i did entity or service… one entiy glitchs the pop up card… and service… you can keep clicking it but it doesnt execute… but regular toggles work fine… so how do you make scripts work

here is a section of the code

              - type: custom:button-card
                template: bootstrap_button
                class: col-xl-2 col-lg-2 col-md-3 col-sm-4 col-4
                entity: group.building_sound
                state_display: |
                  [[[
                    var count = states['sensor.building_sound_on'].state;
                    if (count == 1)
                      return '1 Device On';
                    else return count + ' Devices On';
                  ]]]
                tap_action:
                  action: fire-dom-event
                  browser_mod:
                    service: browser_mod.popup
                    data:
                      title: Building Sound
                      large: true
                      hide_header: false
                      content:
                        type: custom:bootstrap-grid-card
                        global_col_class: col-xl-2 col-lg-2 col-md-3 col-xl-4 col-4
                        cards:
                          - type: row
                            cards:
                              - entity: switch.stage_mixer_1
                                name: Stage Mixer
                                type: entity-button
                                icon: mdi:tune
                              - entity: switch.stage_amp_1
                                name: Stage Amp
                                type: entity-button
                                icon: mdi:amplifier
                              - entity: switch.building_door_1_speaker
                                name: Building Door Speaker 1
                                type: entity-button
                                icon: mdi:speaker
                              - entity: script.turn_on_sound_equipment_and_am640
                                name: Turn On Equip & 640
                                type: entity-button
                                icon: mdi:speaker
                              - service: script.turn_off_sound_equipment_and_am640
                                name: Turn Off Equip & 640
                                type: button
                                icon: mdi:speaker

so i cant get the script to run.

What’s in this template? I tested your general code for checking any Browser Mod issues and all looks fine. So perhaps something in yout button-card template is preventing the tap_action.

so here is whats in the raw code

button_card_templates:
  bootstrap_button_mini:
    template: bootstrap_button
    show_name: false
    size: 39%
    tap_action:
      action: none
  bootstrap_button_short:
    template: bootstrap_button
    show_icon: false
    show_label: true
    styles:
      label:
        - max-width: 90%
        - font-size: 0.9rem
        - color: var(--secondary-text-color)
        - margin: 2.5px 0
      card:
        - padding-top: 0px
        - padding-bottom: 0px
  bootstrap_button_person:
    template: bootstrap_button
    show_entity_picture: true
    color_type: card
    size: 60%
    state:
      - operator: default
        color: var( --ha-card-background, var(--card-background-color, red) )
  bootstrap_button:
    variables:
      red_state: false
      green_state: false
      blue_state: false
      percent: 0
    show_name: true
    show_state: true
    show_icon: true
    hold_action:
      action: none
    tap_action:
      action: more-info
    state:
      - operator: template
        value: '[[[ return variables.red_state ]]]'
        color: var(--label-badge-red)
        id: red_state
      - operator: template
        value: '[[[ return variables.green_state ]]]'
        color: var(--label-badge-green)
        id: green_state
      - operator: template
        value: '[[[ return variables.blue_state ]]]'
        color: var(--label-badge-blue)
        id: blue_state
    styles:
      name:
        - margin-top: 8px
        - color: var(--primary-text-color)
      state:
        - font-size: 0.9rem
        - color: var(--secondary-text-color)
        - padding: 3px 0 2px 0
        - display: block
        - width: 100%
        - color: |
            [[[
              if (!variables.percent)
                return 'var(--secondary-text-color)';
              return 'var(--primary-text-color)';
            ]]]
        - background: |
            [[[
              if (!variables.percent)
                return;
              return 'linear-gradient(to right, var(--accent-color, #f39c12), ' + variables.percent + '%, rgba(100,100,100,0.15) 0)';
            ]]]
    extra_styles: |
      :host, ha-card {
        height: 100%
      }

like it used to work before home assistant latest updates… that i remember… as even the pop up card is no longer white… its gray

so when i press a button on a switch i have … works fine
but when i press the button on the script… it makes the the popup shift or so id have to take a small video if it helps then figure how to upload it

this code was all done from someone elsses template years ago when it was browswer mod 1… and then i had to convert it to work in broswer mod 2

Best to try a minimal example, unpacking templates and styling to see where the issues may be.

I am not quite following what the issue actually is. You mention script buttons but they are on the popup. So is the popup showing but you then have issues?

so the

                              - entity: script.turn_on_sound_equipment_and_am640
                                name: Turn On Equip & 640
                                type: entity-button
                                icon: mdi:speaker
                              - service: script.turn_off_sound_equipment_and_am640
                                name: Turn Off Equip & 640
                                type: button
                                icon: mdi:speaker

doesnt work orginally i i use - entity: but cuz it causes the window to pop up to shift and not execute the script… and then none of the buttons work

so i went to look up the browswer mod on github and i found service… now its not exactly like what they have as this using different mods dont seem to always pop up right…

ill make a video to show whats going on be a bit and ill have to link it to my One Drive account

I think as it stands these will bring up more-info of the script, not execute the script. Try using action script.turn_on.

              - entity: script.turn_on_sound_equipment_and_am640
                name: Turn Off Equip & 640
                type: entity-button
                icon: mdi:speaker
                tap_action:
                  action: perform-action
                  perform_action: script.turn_on
                  target:
                    entity_id: turn_on_sound_equipment_and_am640

so that didnt work
i had to add script. in front of the turn_on_sound and what it does it just leaves the light button yellow… for script

now i found the script only works once and a while now… it looks like i guess one of the updates modified things… you cant turn switch on by entity anymore??

and i currently updating the next home assistant so ill test it after

but the code for the script that worked in the past

alias: SOUND - STAGE - Turn on sound equipment and Am640
sequence:
  - target:
      entity_id:
        - switch.stage_amp_1
        - switch.stage_mixer_1
        - switch.building_door_1_speaker
    data: {}
    action: switch.turn_on
  - target:
      entity_id: media_player.building_volumio
    data: {}
    action: media_player.media_play
mode: single
description: ""

that now only works once and then cant be used again for like 4 min 5 min

so i tried adding new switchs so those 3 i re added

alias: SOUND - STAGE - Turn on sound equipment and Am640
sequence:
  - target:
      entity_id:
        - switch.stage_amp_1
        - switch.stage_mixer_1
        - switch.building_door_1_speaker
      device_id:
        - 14729f5ccdfd72a969ff19f841e3ef82
        - 7e1e39882eddf11d661b1a6965b5d09f
        - 58884d5e3fc8741c1acc504d5e61bbc2
    data: {}
    action: switch.turn_on
  - target:
      entity_id: media_player.building_volumio
    data: {}
    action: media_player.media_play
mode: single
description: ""

i havent tested yet… but i guess i cant do entity_id anymore

so ill re do it… i liked switch.stage_mixer_1 just easier to read but if i gotta convert to device_id

and ill get back to you after home assistant finishes updating as i dont wanna bugger things up i have real slow internet

i tried the script i find that volumio play media is crashing the script… if i run it and turn off the 3 switchs manually… and re run the script it cant

if i remove the volumio part and run it… i can manually shut off the switchs… and run the script again…

so i guess its glitching or hanging with media_player for volumio

EDIT: Posted before you last reponse. So yes, that will be your issue with your script.

Check the script. Perhaps that is where the change is.

Anyhow, not seeing any Browser Mod issues. While I might be able to help you further I expect it will be difficult given this seems tied up in your environment and not any issues with Browser Mod.

i not sure ya and the browser mod github doesnt really break down things right shows 1 tap thing and since i been running this like 5 years now i guess and havent changed anything except to go from 1 to 2 browswer mod i not an expert… i not even sure what the browswer mod id is for i guess means for a different browser so it will show landscape for 1 and portart for another … as i never played with that

here is the videos 2 of them i made of the current setup i had… ill make those script tweaks… i dont know know how volumio locks up a script now… but ill make the changes after ha updates and reboots as i dont wanna make a change and boom something messed up been there…

but here is those videos
home assistant issue

and ill let u know if anything is fixed once i repair the script… i guess i need to read the release notes everytime there is a HA update… as i just update and as long as spook doesnt find a problem i figure everything is running fine lol

OK, looking at your videos, your main issue is how button-card has changed. When you set a script entity for the button-card, it will not allow to action again until the script is finished. From what you described earlier, you are expecting your script to be quick, but it is not, hence the issues you are seeing. I also expect that button-card’s blocking scrim is affecticting using all the other buttons. As for this, it may change once you use Browser Mod 2.8.0 with Home Assistant 2026.3. So do those updates and then see.

So if anything, there may be something Browser Mod can do to work with button-card issues, but it would be working around that, not fixing any Browser Mod issue.

ah ok so i not going crazy…
i having issues testing… and HA i guess corrupted updating

when i try to create a button to test … or enties i get this error now

Configuration error
Failed to fetch dynamically imported module: http://homeassistant:8123/frontend_latest/99117.e72edebe1c9be2a6.js

so not sure how to fix that… looks like everything is workin for rest of my home assistant i just cant create new cards all the cards have that error

do you happen to know how to fix that?
ill try buttons and the script issue again tommorow … its always something right lol

Refresh caches.

ok i got it working…
with your updated code i modified it… also the new update of HA just fixed that gray popup window its now restored to white… guess there was a glitch with that they fixed

i also figured what also changed since i created the scripts when you turn on the script stays running it says… it doesnt run the stop… now the scripts stay running and dont exit… since i never changed the code in years i never knew there was an issue…

so my turn off button script i added script

action: script.turn_off
metadata: {}
target:
  entity_id: script.turn_on_sound_equipment_and_am640
data: {}

i had to add that that also seemed to bugger things up cuz it was running…
dont know but it all seems to be running again… like it used to… ill have to check all my scripts and automations for broken grayed out stuff

i appreciate your help your code fixed things and no more shifting etc…
the old code i had ya still didnt work but yours worked… gets confusing when things change or a different card uses the code slightly different then from the button card etc… glad you know what your doing as i didnt lol

1 Like

You may need to check your script as it should complete.

Glad to be able to help.

ya stays running i did a test of a new button

show_name: true
show_icon: true
type: button
entity: script.turn_on_sound_equipment_and_am640
tap_action:
  action: perform-action
  perform_action: script.turn_on_sound_equipment_and_am640
  target: {}


so maybe cuz i do the perform action where the button stays ON its Saying its running doesnt mean the Script is running but the Button is running… is my guess how that means… so i miss interepting whats running… its not the script that is running… its the button is running in on pos is what i guess thats really what it means there

No, this means the script is running. Check the script and traces to see how long it takes which may give you an idea of what is taking some time.

i not sure how you trace or debug if you can

but i did remove what i mentioned probably issue

  - target:
      entity_id: media_player.building_volumio
    data: {}
    action: media_player.media_play

it should just play media on volumio and exit right away… seems to hang in an endless loop… wonder why

but if i remove it… and i did the More Info it went to idle right away… so i guess ill have to see why the volumio is hanging it… guess thats a tommorow look at lol

maybe ill try tommorow delete the intergration and re add it. maybe that will help