Strugging to find a way to trigger an automation from a button:

No idea why this would not work, tried multiple methods of passing the entity but the error keeps asking for ‘at least one entity’. Below are two service calls I tried, but neither works.

                - entity: automation.bedtime
                  name: Bedtime Lights
                  layout: icon_name
                  tap_action:
                    action: call-service
                    service: script.turn_on
                    target:
                      entity_id: script.bedtime
                - entity: automation.bedtime
                  name: Bedtime Lights
                  layout: icon_name
                  tap_action:
                    action: call-service
                    service: automation.trigger
                    target:
                      entity_id: automation.bedtime

Is this code for some kind of a lovelace card in which case you appear to me missing the “type: xxxxxxx” field so please check the doc’s for the relevant card.

Also, what is it that you are actually trying to do i.e. fire script.bedtime or the automation.bedtime?

Yeah it is the popup card from the browser mode popups (more info replacement). Everything else works well, I just don’t know what I am doing wrong in the tap-action piece to call the automation.trigger service call, or the script I created to trigger the automation.

Here is the fuller version:

  group.all_lights:
    title: Scenes
    card:
      type: vertical-stack
      cards:
        - type: markdown
          content: >
            # <img width="20" height="20" src='/local/icon/scenes.png'
            style='vertical-align:middle' /> 
            <font color= white> Scenes </font>
          style:
            .: |
              ha-card {
                background-color: transparent !important;
                box-shadow: none !important;
              }
            ha-markdown:
              $: |
                h1 {
                  font-size: 22px;
                # font-weight: bold;
                  text-align: left;
                  letter-spacing: '-0.01em';
                }
        - type: entities
          entities:
            - type: custom:paper-buttons-row
              buttons:
                - entity: automation.bedtime
                  name: Bedtime Lights
                  layout: icon_name
                  tap_action:
                    action: more-info

Unfortunately I am not familiar with using broswer_mod and pop-up cards.

I would say that the group.all_lights: at the begining looks a bit odd.

Maybe you could try breaking this down a bit and getting it to work as a normal vertical stack.

Sorry I can’t be of more help and perhaps others can hopefully assist.

Thanks for trying. Sorry if my question isn’t clear enough.

It works very well with or without the popup card, when the tap action is set to more-info. But when I switch to a call service action - which is what I want - call the automation.trigger service or call a script.trun_on service it doesn’t like how I am passing on the entity to that.

So the basic question has nothing to do with popup card or any other card, it is how do I trigger an automation or script from a button in lovelace. Meaning I want to bypass the triggers and conditions and run all the actions of an automation manually by tapping on a button in lovelace, is there a way to do that somehow?

Seems like a small task to do, but for the life of me I can’t find a way to do this, not for lack of trying, or any documentation or topics on that topic in this forum, hence asking it.

Any and all help appreciated.

I would say that the group.all_lights: at the begining looks a bit odd.

That is how popup cards work - instead of getting the more info screen with the history, which is tpretty useless for this purpose, when I click the group.all_lights button on this dashboard it opens up another dashboard (calling it that for simplicity) with whatever I want to show - for e.g. I could show all the lights that are currently on with a group of scenes and automations I can quickly trigger that I have created under the popup card for that entity.

Bump - anyone?

I’m not sure how that custom Paper Buttons works, but here is the YAML for one of my working buttons:

  - type: button
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        skip_condition: true
      target:
        entity_id: automation.reset_noon
    name: Manual Reset (Noon)
    icon: mdi:weather-sunny
    show_state: false
    show_icon: true
    icon_height: 50px

The only real difference I notice is that I don’t supply an entity for the button and I’m not sure of the importance of that.

It may be silly, but can you confirm you have the names correct for either the script or the automation and that conditions aren’t blocking anything from continuing?

Also, it’s easier for everybody if you just copy the entire error you are seeing over to your post, just in case you happen to focus on the wrong thing when just describing it.

Sorry for the late reply, I had moved onto other things and then the holidays. Haven’t had a chance to try this yet, will try and update when I get back home tomorrow.

Did not work, but thanks for trying. I have just used the scenes for now and tied the scene being called as a trigger for the automation to trigger for now. Needed that anyways for the voice command scene activations as well.

1 Like