-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed inclorrect rlock usage. Extended exceptions handler
- Loading branch information
Showing
5 changed files
with
45 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
|
||
class TeslaException(Exception): | ||
def __init__(self, code, *args, **kwargs): | ||
self.message = "" | ||
super().__init__(*args, **kwargs) | ||
self.code = code | ||
if self.code == 401: | ||
self.message = 'UNAUTHORIZED' | ||
elif self.code == 404: | ||
self.message = 'NOT_FOUND' | ||
elif self.code == 405: | ||
self.message = 'MOBILE_ACCESS_DISABLED' | ||
elif self.code == 408: | ||
self.message = 'VEHICLE_UNAVAILABLE' | ||
elif self.code == 423: | ||
self.message = 'ACCOUNT_LOCKED' | ||
elif self.code == 429: | ||
self.message = 'TOO_MANY_REQUESTS' | ||
elif self.code == 500: | ||
self.message = 'SERVER_ERROR' | ||
elif self.code == 503: | ||
self.message = 'SERVICE_MAINTENANCE' | ||
elif self.code > 299: | ||
self.message = "UNKNOWN_ERROR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from teslajsonpy.BatterySensor import Battery | ||
from teslajsonpy.BinarySensor import (ChargerConnectionSensor, ParkingSensor) | ||
from teslajsonpy.Charger import ChargerSwitch | ||
from teslajsonpy.Climate import (Climate, TempSensor) | ||
from teslajsonpy.controller import Controller | ||
from teslajsonpy.Exceptions import TeslaException | ||
from teslajsonpy.GPS import GPS | ||
from teslajsonpy.Lock import Lock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters