Automation: add condition: Tesla navigation arrival time between 1-45 minutes

Got it, that makes sense - in that case, would it work if I reverse the order - making the arrival time the trigger and the device_tracker state: home the condition? Although, at the time I tested, it should have simultaneous changed the device_tracker state and the arrival time I think

Yes. As suggested above, use a Numeric State Trigger.

If the device_tracker only reports proximity for one location then there may be no need to add a State Condition (to confirm the device_tracker’s state is home).

Double-check because that may change what needs to be done to fix it.

BTW, you can test the automation by “forcing” the device_tracker’s values. Select the device_tracker in Developer Tools > States, set values for state and minutes_to_arrival then click the Set State button.

Settings its values this way is sufficient to activate the automation’s trigger but the values are not permanent and will be changed by the device_tracker’s integration, whenever it updates, or when Home Assistant is restarted.

Well it looks like I did test it the way we’re discussing as well and it didn’t trigger:

image

I believe the destination_location_tracker state being ‘home’ is needed - because the automation should only trigger if I’m navigating home - not if I’m navigating to any other destination

Can’t do much if it reports unknown.

The developer tools insight for testing you gave me is very interesting, I’m going to look at that right now a bit - and I’m trying to go through the logbook to show you what Home Assistant displayed while I was out doing the live tests. But the Unknown in the screenshot above is only because it’s a live screenshot and the car is not currently navigating to any destination. When it is - those two values show correctly (minutes to arrival shows a decimal like 4.6 and Destination location tracker shows home)

Also, not sure if this screenshot is helpful, but how do I force the attribute value from here?:

Click the blue link then scroll to the top of the page where the selected entity’s properties will be displayed in a form.

Ah got it thank you

Also, here’s the logbook from when I was testing live:

Rather than relying on the Logbook, refer to the automation’s trace.

I think I’m going to go out and do a live test in the car while watching the developer tools state and see if it shows numbers as I’d expect them to look… because the arrival time is seeming to update in the logbook but the minutes to arrival attribute doesn’t show up in the logbook… making me curious

Wow this conversation is super helpful so far thanks so much, I’m going to take a look through that automation trace link you just sent me

Logbook reports entity state-changes.

Minutes to arrival is an attribute of the entity, not its state

Reference

State Objects

Looks like it’s getting hung up here

Idea: Maybe I put in a 2 minute wait here before the minutes to arrival attribute condition kicks in (because the data is polled from Tesla every 1 minute). It may be a timing issue?

Btw, as a new user I just hit my post limit for the day - I can’t post any additional posts so I’m editing this post to include the idea

*And - reverse the order so the 1-45 minutes to arrival is the trigger, for 2 minutes, then condition the destination being home

Ok I’ll work on it and report back tomorrow thanks again for all your guidance - much much appreciated!

The attribute’s name is shown in the screenshot you posted above. It uses spaces, not underscores, and the first letter is capitalized.

Please don’t do that; it makes the topic difficult to follow.

Fix the attribute’s spelling and then report your progress tomorrow.


NOTE

For future reference:

  • If you click the “Reply” circled in green then I will be automatically notified.
  • If you click the “Reply” circled in red then I will not be notified.

I fixed the attribute’s spelling and that fixed the issue, all is working well thanks again for all your guidance - lots of it will be helpful for the future too! Warm Regards!

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

I know this was a couple of years ago, but… are you able to post your final (working) automation? I’m having issues with attributes as well, and a known/good script would help out.

1 Like