alandtse / tesla

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.
Apache License 2.0
599 stars 99 forks source link

Allow disabling increased frequency polling when car is driving when using TeslaMate MQTT and/or Fleet API #1038

Open philjohn opened 2 months ago

philjohn commented 2 months ago

Is your feature request related to a problem? Please describe.

According to https://github.com/alandtse/tesla/wiki/Polling-policy when the car is driving the polling is changed to every 60 seconds.

Unfortunately with the Fleet API limits of only 300 API queries a day this quickly exhausts the allowed limit and further polling then fails and the integration can't be used to view up-to-date information.

This is doubly problematic when using TeslaMate as Tesla seems to disable the streaming telemety updates at the same time.

Describe the solution you'd like

When electing to update sensor values from MQTT when using TeslaMate OR when using the Fleet API, I would like to be able to disable the automatic changes to polling frequency - and for the polling frequency entered during configuration to be adhered to.

Describe alternatives you've considered

I've had to disable polling by the integration entirely now, and only use the integration for updates, however, since not all sensor values update from MQTT this leads to issues, e.g., last updated sensor.

philjohn commented 2 months ago

OK, digging deeper, it's the only behaviour supported by the underlying Tesla python client used and there's no way to override it (set as a const).

I'll open up a PR there as well to allow it to be passed in as a param to the controller class.