Some new changes, both app and driver update.
Decided to add attributes to show the last token update time, and the next scheduled time.
You can now use an app or right a rule to notify if the token update time does not change every so often.
It turned out to be a little more complicated than I thought as the updates occur in the app and the attributes are in the child driver.
I had to enumerate through children and call the fx in the child driver.
I also thought about the changes I wanted to do where commands were not working becuase the wake command it not finishing before the actual requested command is issued..
The 2 sec pause between the commands used to be sufficient but apparently tesla's api is slower now or something.
Anyway I talked about waking,, check status, till awake, issue command and check status again.
This would be a great deal of code change so as a stop gap to test I made the pause time user configurable in the app, It now is 2, 3, 4, 10, etc seconds
Since 2 secs is not working I also changed the default to 10 secs.
You need to go back in the app and set the new parameter.
8-10 secs seems to work well for me at least for my lock and unlock commands.
Of course as always you wont see the updated status in the car device unless you also do a refresh or wait for the next cycle.
Related to this I also implemented code to sense the vehicle unavailable error on any command, pause the pauseTime and issue a wake, pause again and then retry the command up to 3 times.
The pause will get exponentially longer based on your set pause time and the attempt number.
So if for example your pause time is set to 4 secs. it will after getting the error
pause 4 secs
issue the wake
pause 4 more secs.
retry the command
if it still fails on the next iteration it will pause for 8 secs instead etc. etc.
See below for example.
I also had to add an attribute with time in integer secs to make writing the rule easier.
Here is the rule I wrote to check, but there must be a better way. Someone more knowledgeable in doing date time match in rule machine may know and if you have a better way maybe I dont need the extra attribute .. thanks
These are some big changes and it took awhile.. especially the retries with exponential backoff.
So please test.