Fix lint errors and PR comments

This commit is contained in:
Joseph Hughes 2016-01-14 14:19:35 -07:00
parent 313cbda0aa
commit 9210c57c2d
4 changed files with 16 additions and 11 deletions

View File

@ -39,8 +39,10 @@ omit =
homeassistant/components/mysensors.py
homeassistant/components/*/mysensors.py
homeassistant/components/nest.py
homeassistant/components/*/nest.py
homeassistant/components/binary_sensor/arest.py
homeassistant/components/binary_sensor/nest.py
homeassistant/components/binary_sensor/rest.py
homeassistant/components/browser.py
homeassistant/components/camera/*
@ -97,7 +99,6 @@ omit =
homeassistant/components/sensor/eliqonline.py
homeassistant/components/sensor/forecast.py
homeassistant/components/sensor/glances.py
homeassistant/components/sensor/nest.py
homeassistant/components/sensor/netatmo.py
homeassistant/components/sensor/openweathermap.py
homeassistant/components/sensor/rest.py
@ -123,7 +124,6 @@ omit =
homeassistant/components/thermostat/heatmiser.py
homeassistant/components/thermostat/homematic.py
homeassistant/components/thermostat/honeywell.py
homeassistant/components/thermostat/nest.py
homeassistant/components/thermostat/radiotherm.py

View File

@ -23,6 +23,7 @@ BINARY_TYPES = ['fan',
'hvac_emer_heat_state',
'online']
def setup_platform(hass, config, add_devices, discovery_info=None):
"Setup nest binary sensors from config file"
@ -32,8 +33,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for device in structure.devices:
for variable in config['monitored_conditions']:
if variable in BINARY_TYPES:
add_devices([NestBinarySensor(
structure,
add_devices([NestBinarySensor(structure,
device,
variable)])
else:
@ -44,9 +44,12 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"Connection error logging into the nest web service."
)
class NestBinarySensor(NestSensor):
""" Represents a Nst Binary sensor. """
@property
def is_on(self):
"Returns is the binary sensor is on or off"
return bool(getattr(self.device, self.variable))

View File

@ -12,7 +12,6 @@ import homeassistant.components.nest as nest
from homeassistant.helpers.entity import Entity
from homeassistant.const import TEMP_CELCIUS
from homeassistant.helpers.temperature import convert
DEPENDENCIES = ['nest']
SENSOR_TYPES = ['humidity',
@ -29,6 +28,7 @@ SENSOR_TEMP_TYPES = ['temperature',
'away_temperature[0]',
'away_temperature[1]']
def setup_platform(hass, config, add_devices, discovery_info=None):
"Setup Nest Sensor from config file"
@ -75,6 +75,7 @@ class NestSensor(Entity):
return "{}({}){}".format(location.capitalize(),
name,
self.variable)
@property
def state(self):
""" Returns the state of the sensor. """
@ -85,12 +86,13 @@ class NestSensor(Entity):
def unit_of_measurement(self):
return SENSOR_UNITS.get(self.variable, None)
class NestTempSensor(NestSensor):
""" Represents a Nest Temperature sensor. """
@property
def unit_of_measurement(self):
return self.hass.config.temperature_unit
return TEMP_CELCIUS
@property
def state(self):
@ -98,7 +100,4 @@ class NestTempSensor(NestSensor):
if temp is None:
return None
value = convert(temp, TEMP_CELCIUS,
self.hass.config.temperature_unit)
return round(value, 1)
return round(temp, 1)

View File

@ -16,8 +16,10 @@ import homeassistant.components.nest as nest
DEPENDENCIES = ['nest']
def setup_platform(hass, config, add_devices, discovery_info=None):
"Setup nest thermostat"
logger = logging.getLogger(__name__)
try:
@ -31,6 +33,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"Connection error logging into the nest web service."
)
class NestThermostat(ThermostatDevice):
""" Represents a Nest thermostat. """