I have a van that I sometimes go camping in, and it has a battery in it that I want to be charged before I leave. But when it’s just parked in the driveway, I don’t want to keep it fully charged because lithium battery degradation seems to be related to time-at-charge. So lower charge levels mean less degradation.
I’ve installed the gpsd-mqtt integration and I believe that should be working to update my home assistant device’s location, which is great! Now I can track where I’m going.
I have a helper with a dropdown for Home, Preparing, Traveling with the following logic implemented in my Charger automation:
when in Home limit charge to 50%
when in Preparing limit charge to 90%
when in Traveling, no limits
What I’m trying to do now is setup an automation that will run when the vehicle enters or leaves my driveway to set the Helper dropdown accordingly.
I’ve created another zone called Driveway as opposed to Home (which is the location of the home assistant device itself, to my understanding) and I’m trying to setup an automation. But I don’t seem to have any entities with a location that I can use to compare with the Driveway zone to see if the van is Home or Traveling.
I also tried looking at Helpers and setting up a template sensor but I couldn’t find anything in the UI that had a device class that looked like a location.
These are the automations I’ve tried to make:
Settings > Automations > Create Automation > Create new automation
Then
Add trigger
Time and Location > Zone > Entity list is empty
Add trigger
Other triggers > Geolocation > Source is empty (no dropdown)
My suspicion is that I’m missing something silly but I just can’t figure out what. I’ve looked at 20-30 threads that have to do with RVs and boats and home_assistant.set_location but that doesn’t seem do what I need.
Any help closing the conceptual gap I have is greatly appreciated!
EDIT: The house has a home assistant installation in it, and the van has a home assistant installation as well. In the van it runs the lights and a few other things. My goal is to have the van’s home assistant manage the battery on its own completely independently of the house since it has a full home assistant installation.
I only partially understand what you did but it isn’t hard if I understand correctly.
First, if the driveway is at your home, do not ccreate a zone in the same location as your home. It will confuse HA to choose between which location you are in. If the drivewayzone does not overlap the home zone, it is fine.
You should have a device teacker for the vehicle location. If the device is in a zone, the state of the device tracker is equal to the name of the zone it is in.
So a state trigger or state condition comparing the device tracker for your vehicle with either value “home” or “Driveway” sohould show if the vehicle is at either location.
For automtions, it is always best to check the state of an entity in Developer tools to see what exact value to test for.
If I follow you correctly, your home assistant is running in the van, not your home?
If so, I’m assuming that means your home zone location updates based on the van’s location? If that’s the case, can you set up a fake/virtual device tracker entity with the static coordinates of your house? That way, when that device tracker entity enters your van’s home zone radius, you know the van is at home.
Edit: in my case, I use an ibeacon and ICMP/ping through powerline over shore power from the house to automate based on presence and power loss.
Hey thanks both for the replies! I really appreciate the help. I did edit my post to clarify that I have a home assistant at home and a mobile home assistant in the van and in the van is where I have the gpsd-mqtt integration to update the home zone of the van. So that the van always knows where it is.
@Edwin_D not having two overlapping zones seems like a good idea, I appreciate the tip. I don’t actually have a device tracker that tracks where the vehicle is because default the gpsd-mqtt addon & automation updates the home assistant home location using home_assistant.set_location
I appreciate the “check the dev tools” tip as well. Where I’m stuck I guess is that I don’t know how to get a device tracker created for the van’s own location other than the updates that are being done via the provided automation, I think as a blueprint.
@woodsby yes home assistant in the van, and yes the home assistant location updates as per the gpsd-mqtt integration I found, linked above.
I like your idea of inverting the problem and then I should be able to get my automations to work. Where I’m stuck is how to create a synthetic or fake device to do anything with. It’s probably really easy but I think I’m just missing something.
If the home zone moves with the vehicle, the inverted solution is the way to go. You can use the device_tracker.see action to set a location on a device tracker. Afaik if the device tracker does not exists, it will create one.
I have no clue what happens if the home zone moves and the driveway is stationary. If it does not work, you might need to call device_tracker.see periodically, maybe even with slightly varying coordinates to get it to recheck against zones.
An alternative solution would be to use the proximity integration and check the distance from the driveway.
Thanks again for the help @Edwin_D and @woodsby ! I did some searching and figured out the dev tools and that Services got renamed to Actions and with that I was able to create a “driveway” device with the right coordinates and get the automation going that I needed.