mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 12:15:08 +02:00
slightly better update method.
This commit is contained in:
@@ -7,13 +7,14 @@ import socket
|
|||||||
import logging
|
import logging
|
||||||
from homeassistant.components.thermostat import ThermostatDevice
|
from homeassistant.components.thermostat import ThermostatDevice
|
||||||
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS)
|
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS)
|
||||||
|
logger=logging.getLogger(__name__)
|
||||||
|
|
||||||
REQUIREMENTS = ['evohomeclient==0.2.3']
|
REQUIREMENTS = ['evohomeclient==0.2.3']
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Sets up the nest thermostat. """
|
""" Sets up the honeywel thermostat. """
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
@@ -57,7 +58,7 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Returns the name of the nest, if any. """
|
""" Returns the name of the honeywell, if any. """
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -91,8 +92,12 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
for dev in self.device.temperatures(force_refresh=True):
|
try:
|
||||||
self._current_temperature = dev['temp']
|
# assuming I am only receiving one temperature sensor from the api..
|
||||||
self._target_temperature = dev['setpoint']
|
_device = next(self.device.temperatures(force_refresh=True))
|
||||||
self._name = dev['name']
|
self._current_temperature = _device['temp']
|
||||||
self._sensorid = dev['id']
|
self._target_temperature = _device['setpoint']
|
||||||
|
self._name = _device['name']
|
||||||
|
self._sensorid = _device['id']
|
||||||
|
except StopIteration:
|
||||||
|
logger.error("Did not receive any temperature data from the evohomeclient api.")
|
||||||
|
Reference in New Issue
Block a user