diff --git a/README.rst b/README.rst index 8642834..fcbb6ae 100644 --- a/README.rst +++ b/README.rst @@ -6,6 +6,6 @@ Python API for the Honeywell Lyricâ„¢ Thermostat History ======= -This module was based on http://github.com/technicalpickles/python-nest +This module was based on `python-nest http://github.com/technicalpickles/python-nest` That module was originally a fork of `nest_thermostat ` -which was a fork of `pynest self._cache_ttl: - value = self._get('devices', locationId=locationId) - self._cache[cache_key] = (value, now) + def _devices(self, locationId, forceGet=False): + if forceGet: + cache_key = 'devices-%s' %locationId + value, last_update = self._checkCache(cache_key) + now = time.time() + + if not value or now - last_update > self._cache_ttl: + value = self._get('devices', locationId=locationId) + self._cache[cache_key] = (value, now) + else: + value = self._location(locationId)['devices'] return value @@ -305,10 +829,6 @@ def _device_type(self, locationId, deviceType, deviceId): return device def _devices_type(self, deviceType, locationId): - cache_key = 'devices_type-%s-%s' % (deviceType, locationId) - value, last_update = self._checkCache(cache_key) - now = time.time() - if not value or now - last_update > self._cache_ttl: value = self._get('devices/' + deviceType, locationId=locationId) self._cache[cache_key] = (value, now)