Speak EV - Electric Car Forums banner

Home Assistant and the VW API

6.6K views 34 replies 6 participants last post by  id3tex  
#1 ·
Hi,
I know there's a few people on here use Home Assistant to help manage notifications on their cars. I am just getting into it, initially specifically to send a notification if the car is left unlocked overnight, but obviously there's plenty of other things

Here is what we will be setting up

Image


Will also add lock/unlock etc functions for use with iOs automations.

I wondered who else was playing with this for their car and if there were any good hints/tips you could share.

Thanks

Mike
 
#3 ·
  • Like
Reactions: Jeremy Harris
#4 ·
All I tend to do with HA is control and monitor solar charging and switch preconditioning on before going out, TBH. The solar charging doesn't use the vehicle API, it controls the charge point, so is vehicle agnostic. There's load more stuff I could do, but I've now trimmed my HA dashboards down so only the really useful stuff I use is there,
 
#5 ·
This is interesting and something I could use. I left my car unlocked last night so an auto lock at xxpm if the car has been left for xx mins is an instant win. I'll have a play with it when I get a chance.
Apart from remote locking are there any other functions that can be controlled by HA? Noticed you (@Jeremy Harris) precondition with it. Is that controllable to the point you could set a few conditions? Like only doing it if the car is plugged in? Or send a reminder to plug in if not already?
 
#6 ·
Noticed you (@Jeremy Harris) precondition with it. Is that controllable to the point you could set a few conditions? Like only doing it if the car is plugged in? Or send a reminder to plug in if not already?

Yes, very easy to do, just set up an automation in HA with whatever conditions you want. Could be a timer or based on outside temperature and could also be conditional on the plugged-in entity being true. Automations in HA can be really powerful, I find the hardest part is deciding the exact conditions and values that need to be set in the automation. Getting solar charging to work as I want it to under all conditions is still a bit of a work in progress.
 
#7 ·
Thanks. I'm not sold on the solar benefits for the car. I prefer to export as it pays better. The odd occasion I charge during the day I do it manually. But that's a half dozen times a year.

Agreed on the conditions bit of HA automations. I have a few for lights and things at home. Most recent is the use of a presence sensor in the kitchen to keep the lights on. Needs tweaking but far better than motion sensors so far. To the point I am tempted to use one in the garage. Just takes a while to understand what you are trying to achieve and translate that into HA.
 
#9 ·
I've got this set up with my ID.4 - using the WeConnect APIs mentioned above.
There's a sensor called "overall_status" which is set to "safe" or "unsafe" and this is what I use for most of the above.
If the engine has been off for 5 minutes and the vehicle is "unsafe" then let me know. I then basically manually check why. Obviously this could easily be expanded.

I've got a climate template and matched this up to the car climate, this means I can start and stop the climate from Google Home/Google Assistant and even set the temperature. The only small downside is via Google the only way I could get it to work is have it set up as "heat" so I basically say set "car climate to heat" and this will heat OR cool the car as required.

I'm with OIG - when I plug the car in, HA will wait 5 minutes and then set the percentage charge to OIG to 80-SOC, rounded up to the nearest 5%. I can override this if needed and change the target time manually but it just means most of the time I plug in and everything works to get the car to 80%

The only thing the ID.4 doesn't support, and I'm not sure the API does, is automatically locking/unlocking the doors.
 
#11 ·
We have it set to auto lock the doors if the car is left unlocked after 8pm.
 
#10 ·
Why VW wouldn’t offer this via the app I’ll never know

Image
 
  • Like
Reactions: Rbrian
#15 ·
Great to hear! So many things VW could offer which would genuinely make the cost of Weconnect justified.
 
  • Like
Reactions: MarkyG82
#16 ·
What would be good is if we could share useful automations that work.
Some of the logic seems backwards so things which you think should work, don’t.

For example I tried setting a reminder to charge the car if the range was below a certain amount after 8pm. But it didn’t trigger.
 
  • Like
Reactions: id3tex
#17 ·
What would be good is if we could share useful automations that work.
Some of the logic seems backwards so things which you think should work, don’t.

For example I tried setting a reminder to charge the car if the range was below a certain amount after 8pm. But it didn’t trigger.
That should be quite a simple one. Why don't you post the automation YAML and we can try and figure it out?
 
#18 ·
Ok, not that one but here is an exampe that isn't working

alias: Passat GTE Electric mode low
description: ""
triggers:
- type: value
device_id: 2c10a362a0ff77192eddf760ce44b2f8
entity_id: 432a0a7362b6111283c5f48daf2c0438
domain: sensor
trigger: device
below: 43
conditions:
- condition: time
after: "10:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
actions:
- action: notify.passat_bot1
metadata: {}
data:
target: -4111111111
message: The Grey Whale's Electric range is below 8km
mode: single
 
#20 ·
so if I set the trigger, right now for example, to 11.30 AM and the condition below X amount, should work?
 
#21 ·
I think where I am struggling is the "status" side of things.

i.e. drive the car, park up but forget to lock. I can't work out how to get it to know it's unlocked, without unlocking it first. if that makes sense
 
#22 ·
like just for testing, why wouldn't this work?
alias: Passat GTE Electric mode low
description: ""
triggers:
- trigger: numeric_state
entity_id:
- sensor.passat_gte_electric_range
attribute: last_updated
below: 45
conditions: []
actions:
- action: notify.passat_bot1
metadata: {}
data:
target: -4523429656
message: The Grey Whale's Electric range is below 8km
mode: single
 
#23 ·
Ok, think we worked it out. Got a few things in testing, I'll add them as I confirm they are working
 
  • Like
Reactions: MarkyG82
#24 ·
Image


Tweaking the routines but loving this.
Got open window and door alerts.
An unlocked heads up.
An automatic lock after 8 pm
and a note to let me know if my EV range is below a certain level after 8pm



value.
 
  • Like
Reactions: Jeremy Harris
#25 ·
An interesting part of this: will the car prevent locking if the keys are inside? 8pm for me is early enough that I might still be using the car. Let's say I just came back from shopping and not looking at my phone due to putting shopping away. I live in a nice enough area that I could leave the car unlocked with the keys in for a short period. Would the car still lock?
Clearly this situation is niche and you could easily set the time to later in the evening.
 
#26 ·
So yes, it can lock with the key in the car. The screenshot above is a bit messy as the ‘heads up’ is a different alert. Even so I’m a ‘key in pocket’ kinda guy.

but the theory is sound. There is a 5 minute warning before it locks and we are looking at a routine to cancel the autolock if it is being worked on (albeit unlikely at 8pm)

otherwise you can change that delay and obviously change the lock time.

I’m in London and we regularly get car dippers so it could be handy for that rare occasion I completely forget.

Otherwise the reminders will likely make me lock it manually via the Key or App.
 
  • Like
Reactions: MarkyG82
#27 ·
Oh and don’t forget. If you’ve locked the keys in the car, you can unlock via the App (or hopefully in phase 2, via Siri 😎)
 
#31 ·
Anyone know a way to use Siri to send commands to a Telegram bot (from user)?

We've got commands working, so i can lock my car with a /lock message, but it would be awesome to be able to use Siri for this...
 
#32 ·
Thanks for these tips I've now got 'car is unlocked' alerts working through HA for my T-Roc.

Has anyone had any luck with getting API status of the alarm?

There's no indication in the cockpit, or mobile app that the alarm is enabled/disabled or been activated, other than maybe a notifcation/email when its set off.


Apparently double pressing the car key fob will disable the alarm, but I'd like to know for sure - sometimes I want to do this deliberately, other times I may do it accidentally.
 
#34 ·
Same, nothing for the Tiguan or Passat .