Automation that is triggered from App is not executed

Hi Community,

I hope somebody can help me with my issue.
I configured an automation, to open the garage after some delay.

- id: '1712773907024'
  alias: open Garage in 3min
  description: ''
  trigger:
  - platform: state
    entity_id:
    - input_button.garage_on
  condition: []
  action:
  - delay:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  - service: cover.open_cover
    target:
      entity_id: cover.garagentor
    data: {}
  mode: single

My issue is now, it seems that delay is started(and running) on the phone(app) directly and triggering the actual entity after that delay is reached from the phone (and not running on the server).
BUT as I’m using a VPN and disconnecting that VPN after I pushed the button for that automation, the HA app can’t reach the HA server anymore and therefor wouldn’t trigger the entity to open the garage.

I have a new HAOS installation, running at version 2024.5.4.

Am I right with my assumption?

Thanks in advance for you help!

what makes you believe that the code waits and runs locally in the client? it should be running on the server. if it’s not working i think there’s likely something else wrong…

A little more description about the issue.
I’m connected to VPN(from phone, while using my 4G connection), I open HA app on my phone which connects to HA at home.
I trigger the button for “open garage” after that I disconnect my VPN and like 5min later the garage is still not opened. So I open the garage manually while being connected to my local wifi.
BUT as I’m now at home and connected to with my wifi, HA for some reason now is closing the garage after some time (I did not measured the exact time).
But that’s actually the second weird part of that issue, but let’s first clear the how the flow really works…

I can’t think of another reason why such behavior should happen if the delay and all that is directly running on the HA server after being triggered.
If I’m connected from wifi and trigger that automation, it’s working fine as it should.

i think the best thing to do is to go look at the trace for when it failed. you know how to do that? (it’s at the upper right of the page when you open the automation in the ui)

and if you’re having trouble interpreting the trace, then download the json version (when you’re in the track, hit the upper right 3 dots) and post the json here.

be sure to get the trace for the failed execution… use the time spinner in the top middle to find it.

That is from today when it did not worked and I was connected from VPN.

next examples comes in 4 minutes :wink:

second trace from VPN, that did not worked.

that’s not the automation trace. the actual trace is the “step details”… which is useful for you to use but it’s not good to post here because it doesn’t show the whole trace of the automation, it shows one step at a time.

seeing as you’re new to this, please grab the download and post the download here.

see download trace upper right

okay, that will be a long post, as I cant add just the files.

First trace 2:39PM

{
  "trace": {
    "last_step": "action/1",
    "run_id": "5a8955a595b3559e6352ed43f7c30de3",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-06-05T12:39:15.589555+00:00",
      "finish": "2024-06-05T12:42:15.594122+00:00"
    },
    "domain": "automation",
    "item_id": "1712773907024",
    "trigger": "state of input_button.garage_auf",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2024-06-05T12:39:15.589590+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.garage_auf",
              "state": "on",
              "attributes": {
                "id": "1712773907024",
                "last_triggered": "2024-05-25T09:03:58.955377+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Garage Auf 3min"
              },
              "last_changed": "2024-05-31T10:06:01.063193+00:00",
              "last_reported": "2024-05-31T10:06:01.063193+00:00",
              "last_updated": "2024-05-31T10:06:01.063193+00:00",
              "context": {
                "id": "01HZ71T2V7F959RQ7TNECYZ705",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "state",
              "entity_id": "input_button.garage_auf",
              "from_state": {
                "entity_id": "input_button.garage_auf",
                "state": "2024-05-25T09:03:58.955129+00:00",
                "attributes": {
                  "editable": true,
                  "icon": "mdi:garage-open-variant",
                  "friendly_name": "Garagentor öffnen 3min"
                },
                "last_changed": "2024-05-31T10:05:56.788589+00:00",
                "last_reported": "2024-05-31T10:05:56.788589+00:00",
                "last_updated": "2024-05-31T10:05:56.788589+00:00",
                "context": {
                  "id": "01HZ71SYNM4KWTHR2B6V32NCXG",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "input_button.garage_auf",
                "state": "2024-06-05T12:39:15.589230+00:00",
                "attributes": {
                  "editable": true,
                  "icon": "mdi:garage-open-variant",
                  "friendly_name": "Garagentor öffnen 3min"
                },
                "last_changed": "2024-06-05T12:39:15.589302+00:00",
                "last_reported": "2024-06-05T12:39:15.589302+00:00",
                "last_updated": "2024-06-05T12:39:15.589302+00:00",
                "context": {
                  "id": "01HZM6J8W5DP9P5SPMW9KCDZH2",
                  "parent_id": null,
                  "user_id": "6e8eade441f344d3977d6e0f11b9a51a"
                }
              },
              "for": null,
              "attribute": null,
              "description": "state of input_button.garage_auf"
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-06-05T12:39:15.589972+00:00",
          "changed_variables": {
            "context": {
              "id": "01HZM6J8W594VDP2YJ2S44BRCV",
              "parent_id": "01HZM6J8W5DP9P5SPMW9KCDZH2",
              "user_id": null
            }
          },
          "result": {
            "delay": 180,
            "done": true
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-06-05T12:42:15.590956+00:00",
          "result": {
            "params": {
              "domain": "cover",
              "service": "open_cover",
              "service_data": {},
              "target": {
                "entity_id": [
                  "cover.garagentor"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1712773907024",
      "alias": "Garage Auf 3min",
      "description": "",
      "trigger": [
        {
          "platform": "state",
          "entity_id": [
            "input_button.garage_auf"
          ]
        }
      ],
      "condition": [],
      "action": [
        {
          "delay": {
            "hours": 0,
            "minutes": 3,
            "seconds": 0,
            "milliseconds": 0
          }
        },
        {
          "service": "cover.open_cover",
          "target": {
            "entity_id": "cover.garagentor"
          },
          "data": {}
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HZM6J8W594VDP2YJ2S44BRCV",
      "parent_id": "01HZM6J8W5DP9P5SPMW9KCDZH2",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Garage Auf 3min",
      "message": "triggered by state of input_button.garage_auf",
      "source": "state of input_button.garage_auf",
      "entity_id": "automation.garage_auf",
      "context_id": "01HZM6J8W594VDP2YJ2S44BRCV",
      "when": 1717591155.5897539,
      "domain": "automation"
    }
  ]
}

second trace from 8:30pm

{
  "trace": {
    "last_step": "action/1",
    "run_id": "0936f7646d4627eec251b198a5547944",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-06-05T18:30:46.888066+00:00",
      "finish": "2024-06-05T18:33:46.893993+00:00"
    },
    "domain": "automation",
    "item_id": "1712773907024",
    "trigger": "state of input_button.garage_auf",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2024-06-05T18:30:46.888112+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.garage_auf",
              "state": "on",
              "attributes": {
                "id": "1712773907024",
                "last_triggered": "2024-06-05T12:39:15.589760+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Garage Auf 3min"
              },
              "last_changed": "2024-05-31T10:06:01.063193+00:00",
              "last_reported": "2024-06-05T12:42:15.592806+00:00",
              "last_updated": "2024-06-05T12:42:15.592806+00:00",
              "context": {
                "id": "01HZM6QRN8WAFE0S65GQC3AVBK",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "state",
              "entity_id": "input_button.garage_auf",
              "from_state": {
                "entity_id": "input_button.garage_auf",
                "state": "2024-06-05T12:39:15.589230+00:00",
                "attributes": {
                  "editable": true,
                  "icon": "mdi:garage-open-variant",
                  "friendly_name": "Garagentor öffnen 3min"
                },
                "last_changed": "2024-06-05T12:39:15.589302+00:00",
                "last_reported": "2024-06-05T12:39:15.589302+00:00",
                "last_updated": "2024-06-05T12:39:15.589302+00:00",
                "context": {
                  "id": "01HZM6J8W5DP9P5SPMW9KCDZH2",
                  "parent_id": null,
                  "user_id": "6e8eade441f344d3977d6e0f11b9a51a"
                }
              },
              "to_state": {
                "entity_id": "input_button.garage_auf",
                "state": "2024-06-05T18:30:46.887905+00:00",
                "attributes": {
                  "editable": true,
                  "icon": "mdi:garage-open-variant",
                  "friendly_name": "Garagentor öffnen 3min"
                },
                "last_changed": "2024-06-05T18:30:46.887975+00:00",
                "last_reported": "2024-06-05T18:30:46.887975+00:00",
                "last_updated": "2024-06-05T18:30:46.887975+00:00",
                "context": {
                  "id": "01HZMTNXV7A26PRWXJFDC8F9RZ",
                  "parent_id": null,
                  "user_id": "6e8eade441f344d3977d6e0f11b9a51a"
                }
              },
              "for": null,
              "attribute": null,
              "description": "state of input_button.garage_auf"
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-06-05T18:30:46.888445+00:00",
          "changed_variables": {
            "context": {
              "id": "01HZMTNXV8V8T72Q1C5JK4854J",
              "parent_id": "01HZMTNXV7A26PRWXJFDC8F9RZ",
              "user_id": null
            }
          },
          "result": {
            "delay": 180,
            "done": true
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-06-05T18:33:46.889550+00:00",
          "result": {
            "params": {
              "domain": "cover",
              "service": "open_cover",
              "service_data": {},
              "target": {
                "entity_id": [
                  "cover.garagentor"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1712773907024",
      "alias": "Garage Auf 3min",
      "description": "",
      "trigger": [
        {
          "platform": "state",
          "entity_id": [
            "input_button.garage_auf"
          ]
        }
      ],
      "condition": [],
      "action": [
        {
          "delay": {
            "hours": 0,
            "minutes": 3,
            "seconds": 0,
            "milliseconds": 0
          }
        },
        {
          "service": "cover.open_cover",
          "target": {
            "entity_id": "cover.garagentor"
          },
          "data": {}
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HZMTNXV8V8T72Q1C5JK4854J",
      "parent_id": "01HZMTNXV7A26PRWXJFDC8F9RZ",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Garage Auf 3min",
      "message": "triggered by state of input_button.garage_auf",
      "source": "state of input_button.garage_auf",
      "entity_id": "automation.garage_auf",
      "context_id": "01HZMTNXV8V8T72Q1C5JK4854J",
      "when": 1717612246.8881693,
      "domain": "automation"
    },
    {
      "when": 1717612426.890326,
      "state": "opening",
      "entity_id": "cover.garagentor",
      "icon": "mdi:garage-variant",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Garage Auf 3min",
      "context_message": "triggered by state of input_button.garage_auf",
      "context_source": "state of input_button.garage_auf",
      "context_entity_id": "automation.garage_auf"
    }
  ]
}

hmm… well, i admit i’m not sure why this is happening. but here’s the relvant part of the trace… i’m adding ## comment markers in it.

      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-06-05T12:39:15.589972+00:00",
          "changed_variables": {
            "context": {
              "id": "01HZM6J8W594VDP2YJ2S44BRCV",
              "parent_id": "01HZM6J8W5DP9P5SPMW9KCDZH2",
              "user_id": null
            }
          },
####### this results looks like it waited the proper 3 minutes
          "result": {
            "delay": 180,
            "done": true  
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-06-05T12:42:15.590956+00:00",
          "result": {
            "params": {
              "domain": "cover",
              "service": "open_cover",
              "service_data": {},
              "target": {
                "entity_id": [
                  "cover.garagentor"
                ]
              }
            },
##### to gets to this point.  at first i thought this "running_script": false 
##### indicated an error, but i just tried it on my system and i have this at the end
#####  but my entity is flipped so perhaps this is just indicated that the script
##### is finished and no longer running?
            "running_script": false
          }
        }
      ]

i don’t see anything that indicates what’s causing it, but i’ll ping some folks and see if i can convince someone more expert in this to take a look…

more thoughts for you… take a look at your trace timeline. like this:

i did your same script except that i turned on lights instead of opening a garage door. i hit the button and then disconnected my wifi.

looking at what you posted here:

i think the garage door did try to open.

SO… do this experiment for me… try the exact same thing, but instead of calling cover.open_cover, try toggling lights on/off.

i’m going to guess that this vpn issue is a red herring. i’m going to guess that your lights turn on/off just fine after disconnecting from vpn.

i think there’s probably an issue w/ the garage door or network connectivity from your home assistant to your entity device (not your app).

1 Like

There is no problem with the automation, and your connection is not relevant for this. :open_mouth:

Must be something different, both traces show, that the automations triggered correctly and the actions where executed and no errors where received.

I’d speculate the same as @armedad, there is something not working correctly wiht your garage door. As you noted, it’s closing after a while automatically, so maybe there is some automation running in the garage door controller - not the HA one, maybe the opener has its own automations?

To the connection. It doesn’t matter what you do after pushing the button. The only thing that gets send to HA is the event of you pushing a button. The rest is the automation (that gets triggered by that event) and the automation solely depends on your HA server. So whatever you do after you press the button, is not relevant for this. And in general the HA app on your phone doesn’t care how it reaches the HA server, it just needs to reach it in some way.

To see what’s going on, please post a little more information about ýour hardware. What garage opener do you have, how is it connected and integrated into HA and such things.

1 Like

hey Guys, sorry as a new user I have very limited access, so I had to wait for my next post.

I really appreciate you help on that!!
Pls give me some time to verify all that again.

It’s curios because that issue happened definitely not only once…
But when looking at the logs, I have definitely more questions than it anwsers

So the correct flow seems to have to look like that:
image

For a timeframe that automation did not worked properly, it looked like that
picture 2 comes later

If I look at the cover entity for that garage door, I can see the following, the door was opened like 7 seconds after I pushed the button for the “open in 3min” automation.

picture 3 comes more later

And I verified, If the garage door open and I trigger the automation, the actual cover entity will not be used (so I see no action to open the door at that time).
So thats most likely why for the automations trace, I do not see the “turned opening” command.

I will verify all again, although I was sure it happened not only once before writing here…

sorry, I was not able to go on here yesterday…

picture 2
image

picture 3

I mean it would not make sense to click “open in 3min” and after that click on “open now”

And I checked, if the garage door is open, it will definitely not trigger an “open cover” again

picture 4 coming soon

Maybe pressed multiple buttons which my thick thumb (more kidding)… somehow it seems at least like that…

I have to qualify that more…

If the service is called, but the garage door state does not change as a result, then you experience communitation problems with the garage door. That is: unless the door was already in the desired state. I’m assuming it was not.

What integration is controlling the garage door? is it using the network? Even cloud maybe? And if so, how did you set up the vpn? to the router, or to the device running HA?

I’m thinking maybe the VPN, while active, may be blocking other network traffic or internet traffic as a security measure. Or it may be misconfigured, messing up the network in other ways. Or the other way around? That you configured the garage door integration in a way it needs your vpn to your phone in order to reach a required service?

picture 4

I’m using a KNX and having a KNX IP Gateway in between.
In general I had never issue with is and all other thinks work fine, without any issue…
The Logbook for the KNX integrations does not show any issue… I enabled now the debuggin mode, to see if I can find something there…

Silly thought maybe, but is the state really corresponding with the actual garage door? Maybe you are sent on a wild goosechase by a faulty contact sensor or whatever? Maybe the end state isn’t always reported correctly? Or the door isn’t moving because it thinks it is in a different state?

could you also add on turning on a light right after the call to open the garage door? let’s isolate whether the issue is the garage door or not. if the light also doesn’t turn on, then it’s almost certainly an automation/connectivity issue. if it does turn on, then it’s almost certainly a garage door issue.

I would not think that one sensor or so is not working.
Because I in general, if I’m connected to wifi I don’t see any issue but we also already said the VPN should not be the issue.

BUT I enabled logging on KNX and got the following error message:
destination_address=“2/3/3” payload=“<GroupValueResponse value=”" />" /> for Garagentor - Position: <CouldNotParseTelegram description=“Payload invalid” payload=“”/>

But 2/3/3 is just the positioning state of the garage door, so not related to the actual door opening.

Adding some light to that automation is a good idea. and maybe also adding some automation, if the garagedoor is opened, because as per logs, at some point the garage door was already opened before the 3min timer was elapsed.

Thanks for your ideas, I will give feedback as soon as possible,