Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesla presence seems unreliable #65

Open
etherbrat opened this issue Nov 18, 2024 · 21 comments
Open

Tesla presence seems unreliable #65

etherbrat opened this issue Nov 18, 2024 · 21 comments

Comments

@etherbrat
Copy link

etherbrat commented Nov 18, 2024

Just a heads-up, not an issue until confirmed by someone else. Twice in two days the Presence has remained “Away” after I returned to the garage from an outing. The only way I could restore correct operation was by rebooting my HA machine (RPi5, HA in a Container, located right beside the Tesla in the garage). The Pi5 talks WiFi to an access point which is also located in close proximity. The Tesla shows up in BLE Hero on my phone. I do not have the HA BLE Tracker installed. As best I can recall, the Presence indication has been quite accurate and responsive prior to this. Summer is warming up the garage down here in AU, so it may be a chip temperature problem, although I do have the Pi in an enclosure with a fan.

@etherbrat
Copy link
Author

It happened again today. Three times in a row now.

@iainbullock
Copy link
Collaborator

Others have reported similar issues. I have not had the issue myself and have been unable to reproduce. Temperature might be a factor, it's winter here in the UK so no chance of it getting too hot for me

@etherbrat
Copy link
Author

etherbrat commented Nov 19, 2024 via email

@iainbullock
Copy link
Collaborator

Not sure. I am experimenting with https://gateway.theengs.io/ to track my Apple watch using the same RPi. Seems to work fine. I therefore suggest you can run another iBeacon tracker on the same device, which might turn out to be more reliable than the Presence detection used on this project

@etherbrat
Copy link
Author

etherbrat commented Nov 20, 2024 via email

@etherbrat
Copy link
Author

etherbrat commented Nov 20, 2024 via email

@iainbullock
Copy link
Collaborator

Sorry I misunderstood your previous quetion. You are right the code doesn't look for iBeacons it just scans for the BLE MAC; which should work reliably, but clearly it doesn't.

I recommend you try turning off Presence detection in this code and using another docker container on your device which can provide the required functionality. I haven't tested any project for doing this for the car, but as I said earlier I have got https://gateway.theengs.io working for tracking my Apple watch, so maybe it can be configured to track your car

@etherbrat
Copy link
Author

etherbrat commented Nov 20, 2024 via email

@iainbullock
Copy link
Collaborator

I'm a dev on the core project too, so it might become a circular conversation.

@raphmur @baylanger have a look to see what you think, there are issues with presence detection but I can 't replicate it myself

@etherbrat
Copy link
Author

etherbrat commented Nov 20, 2024 via email

@iainbullock
Copy link
Collaborator

As long as the car is not really away, the commands will still work. The presence detection and command sending are completely seperate and independent of each other in the code. Others who have reported this issue have found command sending still works even when presence doesn't

@etherbrat
Copy link
Author

etherbrat commented Nov 20, 2024 via email

@dglaude
Copy link

dglaude commented Jan 3, 2025

There might be other way to detect presence that you anyway have or need (I use evcc).
My Tesla Wall charger will tell me if the car is connected or not.
Teslamate that I still use for checking SoC (State of Charge) and the battery usage and aging will also know if the car is at home or not, connected or not.

PS: I did struggle a bit to find the right device to talk reliably BLE with the car... at the end I am using a Pi 4 and that what has been the most reliable for me. I believe external BLE USB key might be good as you can position it where you want with a USB extension cable.

@iainbullock
Copy link
Collaborator

RPis with built in BLE seem to be good (I'm using RPi3b+). Many people report issues with USB devices. Probably depends exactly which type you have.

@jipema
Copy link

jipema commented Jan 16, 2025

Just chiming in as I'm encountering the same issue from time to time.
If there is anything I can do to help with troubleshooting, please let me know.

@iainbullock
Copy link
Collaborator

See here. Work in progress to resolve what I believe is causing this for many people. In the meantime if you have automations trying to send commands when the car is away it will definately cause problems

tesla-local-control/tesla_ble_mqtt_core#142

@iainbullock
Copy link
Collaborator

I have implemented improvments into v0.4.3b-dev which is on DockerHub. Main changes are robustness improvements, see the CHANGELOG.

@jipema
Copy link

jipema commented Jan 20, 2025

I'm still having presence inconsistency, but it seems to be more a value not being updated than a BLE issue: MQTT topics are updated while polling, but presence is not.

Maybe presence should be set to true whenever a value is updated?
Here is a log extract, showing entities being updated, but presence remaining off:

Car is present and awake VIN:LRW3XXXXXXXXXXX, sending command
vin:LRW3XXXXXXXXXXX presence has expired, set presence OFF
Command state charge was successfully delivered to vin:LRW3XXXXXXXXXXX
MQTT topic tesla_ble/LRW3XXXXXXXXXXX/sensor/charge_state successfully updated to 89
MQTT topic tesla_ble/LRW3XXXXXXXXXXX/sensor/battery_range successfully updated to 230.40724

@iainbullock
Copy link
Collaborator

Interesting. There are two 'presences' being reported here:

Car is present and awake VIN:LRW3XXXXXXXXXXX, sending command

This one is derived from a call to body-controller-state and results in the Presence_BC binary_sensor in HA. It should get updated during the polling

vin:LRW3XXXXXXXXXXX presence has expired, set presence OFF

This is derived from a passive bluetooth scan i.e. doesn't talk to the car at all. It results in the Presence binary_sensor in HA. It doesn't get updated duirng the polling it is done seperately

I am currently recommending that the passive presence is used as I find it more reliable, and it gets updated more often. However maybe you could compare trends to see how they compare on your system over time

@jipema
Copy link

jipema commented Jan 22, 2025

@iainbullock indeed, after 2 days using the _presence_bc sensor, it seems quite reliable (had to look for it, since it's disabled by default).

@iainbullock
Copy link
Collaborator

Both presence entities work reliably on my setup, but I know it's not the case for some. I will therefore continue to offer both which the user can decide which is best for them, or maybe even apply some logic in a HA to use both

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants