Horizontal Stack and Action Toggle not working

Hi Guys

I’m New in HA, so please forgive me for my stupidity.

I try to made a Horizontal Stack with many Entity Buttons, so i have created first scripts for every Button and if i add the Entity Button on the Dashboard it works with action: toggle.
If i create the Horizontal Stack and add the Buttons i can change anything but it remains on the default action : info.

So here is my config on the Horizontal Stack

type: horizontal-stack
title: Media Control
cards:
  - type: entity-button
    icon: 'mdi:television'
    entity: script.1577740137742
    action: toggle
  - type: entity-button
    icon: 'mdi:apple'
    entity: script.1577745278123
    tap_action: null
    action: toggle
  - type: entity-button
    tap_action: null
    action: toggle
    entity: script.1577745397782
    icon: 'mdi:power'

I have made the changes on the Editor of Lovelance UI and if i save and edit again it writes me on tap_action: null ( but i have write before tap_action: )(only, without none)
If i set tape_action: toggle, it works the toggle but the script was not executed.

Hope you can help me to understand what i made wrong:

i’m on the last release : 0.103.5

Thanks Fonio

Hi Fonio
you can’t toggle a script

if you look at the doc’s

you will see you need to use the call-service to run the script
example: in doc’s

type: entity-button
name: Turn Off Lights
tap_action:
  action: call-service
  service: script.turn_on
  service_data:
    entity_id: script.turn_off_lights
entity: script.turn_off_lights

As scripts are services you can simplify this to:

type: entity-button
name: Turn Off Lights
tap_action:
  action: call-service
  service: script.turn_off_lights

you still need the entity for that entity button

type: entity-button
name: Turn Off Lights
tap_action:
  action: call-service
  service: script.turn_on
entity: script.turn_off_lights
1 Like

Woops. Yes you do.

Oh my godness…thanks a lot a try it today later.
Thank you very much for your quick responses and
i wish you all a happy new year!

I have changed to call-service but same thing i receive the information window before i can execute the command, my code looks now:

type: horizontal-stack
title: Media Control
cards:
  - type: entity-button
    icon: 'mdi:television'
    tap_action: null
    action: call-service
    service: script.turn_on
    service_data: null
    entity_id: remote.harmonyhub
    entity: script.1577740137742
  - type: entity-button
    icon: 'mdi:apple'
    tap_action: null
    action: call-service
    service: script.turn_on
    service_data: null
    entity_id: remote.harmonyhub
    entity: script.1577745278123
  - type: entity-button
    tap_action: null
    action: call-service
    service: script.turn_on
    service_data: null
    entity_id: remote.harmonyhub
    entity: script.1577745397782
    icon: 'mdi:power'

2019-12-31 10_43_55-Home Assistant

Your indentation is not correct. Look at all the examples we gave you.

type: horizontal-stack
title: Media Control
cards:
  - type: entity-button
    icon: 'mdi:television'
    entity: script.1577740137742
    tap_action:
      action: call-service
      service: script.1577740137742
  - type: entity-button
    icon: 'mdi:apple'
    entity: script.1577745278123
    tap_action:
      action: call-service
      service: script.1577745278123
  - type: entity-button
    icon: 'mdi:power'
    entity: script.1577745397782
    tap_action:
      action: call-service
      service: script.1577745397782

Thank You! tom_I now it works :smiley: