Nest fixes (#5011)

* Updated Nest API to have logical names

* Fix NoneType not having replace method in NestSensor constructor

* Move name setting to constructor, in case zone.name causes IO.

* normalize is_online to online

* Updated python-nest API

* push is_* helpers down to python-nest, and use inheritence to implement rather than checking class name

* Update python-nest
This commit is contained in:
Josh Nichols authored and Pascal Vizeli committed 2016-12-22 20:22:07 +01:00
1 parent 5e1e5992af
commit 6c50f53696
6 files changed
+31 -55

No files matched your search

+11 -26
View File
@@ -19,8 +19,8 @@ _LOGGER = logging.getLogger(__name__)
REQUIREMENTS = [
'http://github.com/technicalpickles/python-nest'
'/archive/b8391d2b3cb8682f8b0c2bdff477179983609f39.zip' # nest-cam branch
'#python-nest==3.0.2']
'/archive/e6c9d56a8df455d4d7746389811f2c1387e8cb33.zip' # nest-cam branch
'#python-nest==3.0.3']
DOMAIN = 'nest'
@@ -132,12 +132,12 @@ class NestDevice(object):
self._structure = conf[CONF_STRUCTURE]
_LOGGER.debug("Structures to include: %s", self._structure)
def devices(self):
"""Generator returning list of devices and their location."""
def thermostats(self):
"""Generator returning list of thermostats and their location."""
try:
for structure in self.nest.structures:
if structure.name in self._structure:
for device in structure.devices:
for device in structure.thermostats:
yield (structure, device)
else:
_LOGGER.debug("Ignoring structure %s, not in %s",
@@ -146,12 +146,12 @@ class NestDevice(object):
_LOGGER.error(
"Connection error logging into the nest web service.")
def protect_devices(self):
"""Generator returning list of protect devices."""
def smoke_co_alarms(self):
"""Generator returning list of smoke co alarams."""
try:
for structure in self.nest.structures:
if structure.name in self._structure:
for device in structure.protectdevices:
for device in structure.smoke_co_alarms:
yield(structure, device)
else:
_LOGGER.info("Ignoring structure %s, not in %s",
@@ -160,12 +160,12 @@ class NestDevice(object):
_LOGGER.error(
"Connection error logging into the nest web service.")
def camera_devices(self):
"""Generator returning list of camera devices."""
def cameras(self):
"""Generator returning list of cameras."""
try:
for structure in self.nest.structures:
if structure.name in self._structure:
for device in structure.cameradevices:
for device in structure.cameras:
yield(structure, device)
else:
_LOGGER.info("Ignoring structure %s, not in %s",
@@ -173,18 +173,3 @@ class NestDevice(object):
except socket.error:
_LOGGER.error(
"Connection error logging into the nest web service.")
def is_thermostat(device):
"""Target devices that are Nest Thermostats."""
return bool(device.__class__.__name__ == 'Device')
def is_protect(device):
"""Target devices that are Nest Protect Smoke Alarms."""
return bool(device.__class__.__name__ == 'ProtectDevice')
def is_camera(device):
"""Target devices that are Nest Protect Smoke Alarms."""
return bool(device.__class__.__name__ == 'CameraDevice')