This commit is contained in:
Erik 2015-12-27 21:47:49 +01:00
parent efbaf47dc7
commit c8fa6cc127

View file

@ -116,7 +116,8 @@ class TelldusLiveData(object):
def check_request(self, what, **params): def check_request(self, what, **params):
""" Make request, check result if successful """ """ Make request, check result if successful """
return self._request(what, **params) == "success" response = self._request(what, **params)
return response['status'] == "success"
def validate_session(self): def validate_session(self):
""" Make a dummy request to see if the session is valid """ """ Make a dummy request to see if the session is valid """
@ -164,7 +165,8 @@ class TelldusLiveData(object):
def get_switch_state(self, switch_id): def get_switch_state(self, switch_id):
""" returns state of switch. """ """ returns state of switch. """
_LOGGER.info("Updating switch state from Telldus Live") _LOGGER.info("Updating switch state from Telldus Live")
return int(self._request("device/info", id=switch_id)["state"]) response = self._request("device/info", id=switch_id)["state"]
return int(response)
def turn_switch_on(self, switch_id): def turn_switch_on(self, switch_id):
""" turn switch off """ """ turn switch off """