Did you restart HA from the command line (or however you need to) as opposed to restarting from the frontend?
Also, by “/config/custom_components/…” do you mean something like “/home/homeassistant/.homeassistant/custom_components/…”? You can see where your “config” folder is by going to the Info page in the frontend. You should see a line like this:
Path to configuration.yaml: /home/homeassistant/.homeassistant
What I’m trying to achieve is to update the device tracker entity with, Home, Away, Driving.
I just don’t know how to create a template that the device_tracker component will use.
I can easily use a template that will send text notifications of status to include driving, I just want to have it update the device tracker entity as well.
I think I have that down.
It’s just not showing the state in the image. If you click on the sensor, it shows the state.
Just not sure how to make it show the label.
So I’m just guessing here, but can you set the “unit of measure” attribute with the value you want to see there? (Responding on phone so can’t really try it right now.)
I noticed the same thing. But I’ve verified with Postman - that’s what the server is sending. Maybe you have to sign up for their drive detection feature for the driving data to be valid???
Who knows. It could be reporting if the phone’s WiFi is on, not whether or not it’s actually connected to a WiFi network. When I tested that part I actually turned my phone’s WiFi off and it did eventually show that. Right now my wife happens to be driving in the corn fields and I know she’s not getting any WiFi service, yet it still shows true.
I think I’ll change that attribute from “wifi_connected” to “wifi_on”, since that seems to be what it means.
Yep. just confirmed that it is definitely relating to whether wifi is turned on or not and not it’s connection state.
got my automations working too. So now my device tracker entity displays when I’m in transit.
In the action, the dev_id is the device trackers name. For example, say my device tracker item is device_tracker.joe_ the value for dev_id would be ‘joe_’ (minus the quotes).
The location_name: item is what you would like the ‘label’ on the Device tracker entity to be.
As I think about this some more, although this does seem to satisfy the desire to have the appearance in the frontend as you want it, it will be causing extra events and processing. E.g., although I haven’t verified this, I would think when the platform updates the entity, that will of course cause an event, which will run the automation. The automation will update the entity’s state, which will cause another event, which will cause the automation to run again. Of course, this time, even though it will invoke the device_tracker.see service, the entity won’t actually change, so there shouldn’t be another event. Then things will settle down until the next platform update. (Which, BTW, will probably be every 45 seconds or so, since you’re “in transit”.) So each time instead of just one event, there will be two events and two automation runs. Not terrible, but just be aware.
What might be less than desirable, though, is the state constantly changing to ‘not_home’ (aka ‘away’) and then right back to ‘driving’. At least, that’s what I think might happen.
You might want to watch the log to see if this really is happening. If so, you might be better off customizing the platform than doing this with an automation. It should be fairly easy. E.g., add something like this right before the call to self._see():
if not loc_name and attrs[ATTR_IN_TRANSIT]:
loc_name = 'driving'