Closed petzlux closed 6 years ago
Also this page by another app using the Tesla API has lots of information about how they solved the problem:
@petzlux We can certainly improve this. When I initially created the binding I did not care about the additional drain, as I preferred up-to-date information and rapidness over all the rest. That being said, the Tesla Back-end is behaving in unpredictable ways most of the time, so if you could share your experiences we can further improve it, but because of the erratic back-end (lots of authentication failures, internal server errors, time-outs) I prefer to keep the car online all the time, if not, some of my scripts fail big time. For example, I have a script that opens the gate of the driveway as soon as I change the shift from P to D or R.
If you make the behaviour a non default setting, then the binding user can decide what he wants ? Bonus points if the setting could be exposed as a switch in a sitemap, so that it can be set according to daily circumstances ...
PS: at the moment, how often does the binding check the car status
?
+1 to this issue
What about having a Switch, so it could be dynamically controlled whether to have continuous (streamed) updates? Then it could be controlled by e.g. a schedule or other rules from OpenHab, and I could allow the car to sleep at night.
Any news on this? Keeping the car constantly wokeup kills the 12V Batt in a short period of time :(
@kgoderis any idea if this will be given as option? thanks in advance.
@Rathna-K Thank you for reminding me of this. I will implement this asap
@lephisto Why would keeping the car online kill the 12V battery? I presume you refer to the maximum number of 50% deep discharge/recharge cycles that the battery can have in its lifetime, right? My personal experience is that I had to replace the 12V battery once until now, at the 70K km mark, knowing that it has been forced to be online since almost day 1 (through the openHAB binding). Based on what I read left and right on the various fora, that is rather "reasonable" in terms of lifetime
@kgoderis I dont think killing the battery is the problem. at least not for me. but if I constantly poll then sometimes the servers time me out or it slows my mobile app down. I think there may be some limiters on their end. Also, a little off topic, I have a .net code to add the streaming data to a database. but if I can do this thru persistence in OH then I can just use that. so is streaming storage available in this binding? If so any guidance on how to set it up?
@Rathna-K The Tesla servers do time whatever the settings you actually use ;-0 Their setup is a real black box and sometimes unpredictable. I do know that they have some limiters in place, but I based the polling frequency slightly below what other similar third-party apps are doing, so I feel confident we do not break any of their rules. "Slowing down the mobile app", that's new to me, and I will try it out
You can use persistence for sure, as all the data elements of the streaming output are mapped onto Channels. If you link those to Items, and then setup persistence (https://docs.openhab.org/configuration/persistence.html) you will have all the data.
I have actually a vampire drain of 4kWh per day. I set "ALLOWWAKEUP" to OFF without any changes. I even can't see in the persitence mysql database the car was ever in sleep state. So I assume there is a query prevent the car from going to standby. Can anybody confirm my problem? I shut down my openhab raspberry over night and at the mornig I realised absolutely no vampire drain. The Tesla app took like one minute to wake up my car, so it was definitively in sleep mode overnight.
Do you need any logfiles?
+1 here. Is there any solution in the meantime? I mainly need openHAB to optimize the charging of the car, hence not so time critical. An option to stop the regular refresh would be very helpfull. Thanks a lot for the good work so far!
I think the problem is the following: the ALLOWWAKEUP channel set to OFF will prevent the binding from waking the car. However, once the car is awake (i.e. you drive), the binding will prevent the car from ever going to sleep again.
Maybe the binding should stop querying all the states once it detects the car is under a certain condition, not sure which one though. Maybe not charging && location not having changed for x amount of time && in park?
Edit: something like VisibleTesla is doing:
Allow Sleeping: The app will begin to monitor user activity. If no activity has occurred for 15 minutes, the app will go into Sleep mode. In this mode VisibleTesla will not collect data from your car and tabs will not auto-refresh. This will allow your car to go to sleep if it chooses to. VisibleTesla will still try to collect data when it can, but it won't do anything that will keep your car from sleeping.
I played around with tesla API and figured out:
Every query of the API will prevent the car from going to sleep! Even query of the vehicle_state will prevent the car from going to sleep. Even query of all vehicles will prevent ALL vehicles from going to sleep. That a bug in my opinion. If I've got 10 Teslas in my account, it's almost impossible to get the cars to sleep mode. :-(
Anyway. What I did query Charge_state and Drive_State. If the car is not driving nor charging for more than 20 minutes, I stop the connection to the API for 20 minutes (15 seems like not working every time). After that, I check when my car gets back online trough "/api/1/vehicles". If you check the drive_state or charge_state, the car will be wake up by the API. So queries to drive_state or charge_state are only allowed, when the car is "online".
So in worst case, I'm loosing 20 minutes of data, if I use the car exactly after 20 minutes of using. But I'll save approx 4 kWh per day of vampir drain.
Can this be merged to the code and pushed to us peasants? How do I get this change in my instance? Thanks in advance!
Can this be merged
I hope you are aware that you are discussing on a closed issue - https://github.com/openhab/openhab2-addons/pull/3262 has been merged in February and it claimed to have fixed this issue. If this isn't the case, you should open a new issue and come up with a new PR to fix it.
FYI I'm working on a fix for this that should be ready this weekend, I'll post a link to the PR here once completed
@Rathna-K Look here https://github.com/openhab/openhab2-addons/pull/4218 and provide some feedback if this works better for you please
After I have the binding working now, I have monitored my battery levels. Problem seems to be that API calls to collect data keep the car from going into an energy saving mode, and cause significant battery drain overnight (3-4% per 24h) . This effect is commonly called Vampire Drain.
What could be a fix would be a setting for the binding to first query the
state
of the car, and only proceed if the car isonline
. This behaviour could be a setting for the binding as well.