I have setup the Tesla binding, and it’s working - mostly.
I have found that after a few hours there is a lot of this in the events.log:
2017-05-01 11:06:34.835 [hingStatusInfoChangedEvent] - 'tesla:models:1' changed from ONLINE to OFFLINE
2017-05-01 11:06:50.089 [hingStatusInfoChangedEvent] - 'tesla:models:1' changed from OFFLINE to ONLINE
A in the openhab.log:
2017-05-01 11:06:34.833 [ERROR] [b.binding.tesla.handler.TeslaHandler] - Event Stream : An exception occurred while establishing the event stream for the vehicle: 'java.net.SocketTimeoutException: Read timed out'
2017-05-01 11:06:34.834 [WARN ] [b.binding.tesla.handler.TeslaHandler] - Event Stream : Resetting the vehicle connection because of a failing event stream
I have plenty of bandwidth and there are no congestion issues on my link generally. My suspicion is something at api.tesla.com is getting upset with the number and frequency of requests (when things are working, there appear to be a lot of requests - ie: several per second, even when parked). This has been an issue for some time and I have only just got around to looking at it closely. (My goal is to start/stop the car charging based on power usage in the house and the output of my solar system I’m about to get installed.)
I’m on the release version of OH2, on a Debian system (there was not any beta version - I think - and not game to try the snapshots)
I’m not a programmer, but know my way around a Linux system and good with networking, so happy to provide any data you may need to help debug.
The solution may also be to have some sort of config option for the max requests per second (I see there is a throttler class in the code, but not across Java enough to figure out how it works from my quick look).
I’ve read in this PR that the Tesla API sometimes cannot handle all traffic which might cause your timeouts. Maybe @kgoderis can tell you how to best cope with this.
@sillyfrog Please upgrade to the latest version of the binding.
Ps the tesla backend kills the event stream in an undeterministic way. It is a nightmare for sure
Awesome, thanks for the quick response!
Newbie question, are there docs as to how to upgrade to the very recent code (ie: general case for upgrading addons - I have looked, but hard to find amongst the other noise)? Or should I bite the bullet and update to the apt-get snapshot release (best I can tell, the add-ons are downloaded outside apt-get anyway, so not sure if this would help)?
You don’t have to risk it all and can stay on the 2.0.0 release and only upgrade the latest Tesla 2.1.0-SNAPSHOT binding:
- uninstall your 2.0.0 Tesla Binding via Paper UI (Addons, Bindings)
Download latest Tesla Binding from online repository to your
This should install and start the binding (no openHAB restart required).
Now if someday Karel makes another fix/improvement remove binding JAR and redownload:
To return to the 2.0.0 Tesla release:
- install your 2.0.0 Tesla Binding via Paper UI (Addons, Bindings)
Edit: updated links because online repository recently moved
Awesome! Thanks again, I’ll try this now.
Have a good one!
That looks to have fixed the issue (for the moment at least, 24 hours to be 100% sure).
Something I have noticed is the changing of units (I think based on the numbers) between miles and kilometres.
2017-05-02 20:25:10.096 [ItemStateChangedEvent ] - TeslaOdometer changed from 10727.887104000001 to 10727.936300036736
.jar unloaded and snapshot downloaded
2017-05-02 20:43:54.962 [ItemStateChangedEvent ] - TeslaOdometer changed from 10727.936300036736 to 6666.0
2017-05-02 20:44:07.339 [ItemStateChangedEvent ] - TeslaOdometer changed from 6666.0 to 6666.030569
Removed credentials from tesla.things as per latest docs.
2017-05-02 20:44:30.241 [ItemStateChangedEvent ] - TeslaOdometer changed from 6666.030569 to 6666.0
2017-05-02 20:44:52.805 [ItemStateChangedEvent ] - TeslaOdometer changed from 6666.0 to 6666.030569
2017-05-02 20:45:42.376 [ItemStateChangedEvent ] - TeslaOdometer changed from 6666.030569 to 10727.936300036736
Restarting OpenHab2 (systemctl restart openhab2.service)
2017-05-02 20:48:02.800 [temChannelLinkRemovedEvent] - Link 'TeslaOdometer => tesla:models:1:odometer' has been removed.
2017-05-02 20:48:04.847 [ItemRemovedEvent ] - Item 'TeslaOdometer' has been removed.
2017-05-02 20:48:13.488 [ItemChannelLinkAddedEvent ] - Link 'TeslaOdometer-tesla:models:1:odometer' has been added.
2017-05-02 20:48:15.409 [ItemStateChangedEvent ] - TeslaOdometer changed from NULL to 10727.936300036735701723955571651458740234375
2017-05-02 20:48:21.847 [ItemStateChangedEvent ] - TeslaOdometer changed from 10727.936300036735701723955571651458740234375 to 6666.0
2017-05-02 20:48:33.528 [ItemStateChangedEvent ] - TeslaOdometer changed from 6666.0 to 6666.030569
2017-05-02 20:49:21.142 [ItemStateChangedEvent ] - TeslaOdometer changed from 6666.030569 to 10727.936300036736
It looks like it recovers, and again it could be something at the Tesla end, but thought I would mention it in case there has been a regression somewhere along the way. I (think) I noticed the TeslaChargeRate showing in miles previously (it’s currently showing zero, even though it’s charging again, I’ll keep an eye on this).
Again happy to help anyway I can with testing etc.
I’m based in Australia so potentially something to do with the registered location of the car.