1
0
mirror of https://github.com/USA-RedDragon/badnest.git synced 2025-01-18 18:30:43 +00:00

Merge pull request #10 from USA-RedDragon/update-api

API: Update should be called in the regular class, not the dummy class
This commit is contained in:
Jacob McSwain 2019-10-19 19:20:34 -05:00 committed by GitHub
commit 474fb1adc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ class NestAPI:
self._login_google(issue_token, cookie, api_key)
else:
self._login_nest(email, password)
self.update()
def _login_nest(self, email, password):
r = self._session.post(
@ -56,9 +55,6 @@ class NestAPI:
self._user_id = r.json()['claims']['subject']['nestId']['id']
self._access_token = r.json()['jwt']
def update(self):
raise NotImplementedError()
class NestThermostatAPI(NestAPI):
def __init__(self, email, password, issue_token, cookie, api_key):
@ -87,6 +83,7 @@ class NestThermostatAPI(NestAPI):
self.target_temperature_high = None
self.target_temperature_low = None
self.current_humidity = None
self.update()
def get_action(self):
if self._hvac_ac_state:
@ -240,6 +237,7 @@ class NestCameraAPI(NestAPI):
self.battery_voltage = None
self.ac_voltge = None
self.data_tier = None
self.update()
def set_device(self, uuid):
self._device_id = uuid