Here is the updated Access Token Refresh Piston for the v3 API.
To use this piston, you will first have to obtain a Refresh Token. I used a python script available here. There is also an iOS app called Authla that purportedly can do this as well. I 'm sure there are other options I’m not familiar with. .
The piston employs a workflow workaround for a webCoRE bug that arises with pistons containing multiple POST statements, so a new global variable (type: Boolean) @tokenSwitch is needed. See the instructions within the piston itself for startup instructions.
As noted in this post, if you are using TeslaFi or another third-party service that maintains the access token, do not use this piston. You will have to manually update the value of @accessToken whenever those services refresh your token. (That should occur approximately every 45 days).
Because of the requests here and elsewhere, I’ve posted this without the longer range testing I usually prefer. I’ll update the original post with this new piston after seeing what, if any, feedback, I receive.