TeslaPSModule icon indicating copy to clipboard operation
TeslaPSModule copied to clipboard

Wake-Up

Open rochoje opened this issue 6 years ago • 1 comments

Im having an issue with waking up the car. I know you haven't updated this in a while, so maybe tesla changed something?

I have tried multiple things including Invoke-teslavechiclewakeup -vehicle -token and always receive the same errors.

*note if i wake the car up via the tesla app then all the rest of the commands work just fine

Any suggestions would be greatly appreciated

Invoke-RestMethod : {"response":null,"error":"vehicle unavailable: {:error=\u003e"vehicle unavailable:"}","error_description":""} At C:\Users\rochonj\Documents\WindowsPowerShell\Modules\Tesla\Tesla.psm1:85 char:29

  • ... laCommand = Invoke-RestMethod -Uri "$ApiUri/vehicles/$($Vehicle.Id)/c ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand Write-Verbose : Cannot bind argument to parameter 'Message' because it is null. At C:\Users\rochonj\Documents\WindowsPowerShell\Modules\Tesla\Tesla.psm1:88 char:23
  •     Write-Verbose $TeslaCommand
    
  •                   ~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Write-Verbose], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.WriteVerboseCommand

Invoke-TeslaVehicleCommand : Exception of type 'Microsoft.PowerShell.Commands.WriteErrorException' was thrown. At C:\Users\rochonj\Documents\WindowsPowerShell\Modules\Tesla\Tesla.psm1:1960 char:9

  •     Invoke-TeslaVehicleCommand -Vehicle $Vehicle -Token $Token -C ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-TeslaVehicleCommand

rochoje avatar Jan 07 '19 14:01 rochoje

I'm having the same issue and it seems to be the way that v9 API works now. https://tesla-api.timdorr.com/vehicle/commands/wake.

Working on a fix for the Invoke-TeslaVehicleWakeUp to not use the parent Invoke-TeslaVehicleCommand function and just be independent.

EDIT: Just submitted a pull request after making some quick changes to the code. wake_up works as expected.

Maybe in future code, the script can query if the car is in "asleep" state before sending any API commands. If it's asleep, then send wake_up until it's online, then send command. That way no commands fail.

gescarra avatar Jan 18 '19 18:01 gescarra