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

View File

@ -23,6 +23,7 @@ BINARY_TYPES = ['fan',
'hvac_emer_heat_state', 'hvac_emer_heat_state',
'online'] 'online']
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"Setup nest binary sensors from config file" "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 device in structure.devices:
for variable in config['monitored_conditions']: for variable in config['monitored_conditions']:
if variable in BINARY_TYPES: if variable in BINARY_TYPES:
add_devices([NestBinarySensor( add_devices([NestBinarySensor(structure,
structure,
device, device,
variable)]) variable)])
else: else:
@ -44,9 +44,12 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"Connection error logging into the nest web service." "Connection error logging into the nest web service."
) )
class NestBinarySensor(NestSensor): class NestBinarySensor(NestSensor):
""" Represents a Nst Binary sensor. """ """ Represents a Nst Binary sensor. """
@property @property
def is_on(self): def is_on(self):
"Returns is the binary sensor is on or off"
return bool(getattr(self.device, self.variable)) 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.helpers.entity import Entity
from homeassistant.const import TEMP_CELCIUS from homeassistant.const import TEMP_CELCIUS
from homeassistant.helpers.temperature import convert
DEPENDENCIES = ['nest'] DEPENDENCIES = ['nest']
SENSOR_TYPES = ['humidity', SENSOR_TYPES = ['humidity',
@ -29,6 +28,7 @@ SENSOR_TEMP_TYPES = ['temperature',
'away_temperature[0]', 'away_temperature[0]',
'away_temperature[1]'] 'away_temperature[1]']
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"Setup Nest Sensor from config file" "Setup Nest Sensor from config file"
@ -75,6 +75,7 @@ class NestSensor(Entity):
return "{}({}){}".format(location.capitalize(), return "{}({}){}".format(location.capitalize(),
name, name,
self.variable) self.variable)
@property @property
def state(self): def state(self):
""" Returns the state of the sensor. """ """ Returns the state of the sensor. """
@ -85,12 +86,13 @@ class NestSensor(Entity):
def unit_of_measurement(self): def unit_of_measurement(self):
return SENSOR_UNITS.get(self.variable, None) return SENSOR_UNITS.get(self.variable, None)
class NestTempSensor(NestSensor): class NestTempSensor(NestSensor):
""" Represents a Nest Temperature sensor. """ """ Represents a Nest Temperature sensor. """
@property @property
def unit_of_measurement(self): def unit_of_measurement(self):
return self.hass.config.temperature_unit return TEMP_CELCIUS
@property @property
def state(self): def state(self):
@ -98,7 +100,4 @@ class NestTempSensor(NestSensor):
if temp is None: if temp is None:
return None return None
value = convert(temp, TEMP_CELCIUS, return round(temp, 1)
self.hass.config.temperature_unit)
return round(value, 1)

View File

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