Merge pull request #691 from watchforstock/dev
Adding Honeywell Evohome support
This commit is contained in:
commit
38f28fe24b
1 changed files with 23 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.thermostat.honeywell
|
homeassistant.components.thermostat.honeywell
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Adds support for Honeywell Round Connected thermostats.
|
Adds support for Honeywell Round Connected and Honeywell Evohome thermostats.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/thermostat.honeywell/
|
https://home-assistant.io/components/thermostat.honeywell/
|
||||||
|
@ -11,7 +11,7 @@ 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)
|
||||||
|
|
||||||
REQUIREMENTS = ['evohomeclient==0.2.3']
|
REQUIREMENTS = ['evohomeclient==0.2.4']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
evo_api = EvohomeClient(username, password)
|
evo_api = EvohomeClient(username, password)
|
||||||
try:
|
try:
|
||||||
add_devices([RoundThermostat(evo_api)])
|
zones = evo_api.temperatures(force_refresh=True)
|
||||||
|
for i, zone in enumerate(zones):
|
||||||
|
add_devices([RoundThermostat(evo_api, zone['id'], i == 0)])
|
||||||
except socket.error:
|
except socket.error:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Connection error logging into the honeywell evohome web service"
|
"Connection error logging into the honeywell evohome web service"
|
||||||
|
@ -42,11 +44,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class RoundThermostat(ThermostatDevice):
|
class RoundThermostat(ThermostatDevice):
|
||||||
""" Represents a Honeywell Round Connected thermostat. """
|
""" Represents a Honeywell Round Connected thermostat. """
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device, zone_id, master):
|
||||||
self.device = device
|
self.device = device
|
||||||
self._current_temperature = None
|
self._current_temperature = None
|
||||||
self._target_temperature = None
|
self._target_temperature = None
|
||||||
self._name = "round connected"
|
self._name = "round connected"
|
||||||
|
self._id = zone_id
|
||||||
|
self._master = master
|
||||||
|
self._is_dhw = False
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -67,6 +72,8 @@ class RoundThermostat(ThermostatDevice):
|
||||||
@property
|
@property
|
||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
""" Returns the temperature we try to reach. """
|
""" Returns the temperature we try to reach. """
|
||||||
|
if self._is_dhw:
|
||||||
|
return None
|
||||||
return self._target_temperature
|
return self._target_temperature
|
||||||
|
|
||||||
def set_temperature(self, temperature):
|
def set_temperature(self, temperature):
|
||||||
|
@ -74,10 +81,13 @@ class RoundThermostat(ThermostatDevice):
|
||||||
self.device.set_temperature(self._name, temperature)
|
self.device.set_temperature(self._name, temperature)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" Update the data from the thermostat. """
|
|
||||||
try:
|
try:
|
||||||
# Only take first thermostat data from API for now
|
# Only refresh if this is the "master" device,
|
||||||
data = next(self.device.temperatures(force_refresh=True))
|
# others will pick up the cache
|
||||||
|
for val in self.device.temperatures(force_refresh=self._master):
|
||||||
|
if val['id'] == self._id:
|
||||||
|
data = val
|
||||||
|
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
_LOGGER.error("Did not receive any temperature data from the "
|
_LOGGER.error("Did not receive any temperature data from the "
|
||||||
"evohomeclient API.")
|
"evohomeclient API.")
|
||||||
|
@ -85,4 +95,9 @@ class RoundThermostat(ThermostatDevice):
|
||||||
|
|
||||||
self._current_temperature = data['temp']
|
self._current_temperature = data['temp']
|
||||||
self._target_temperature = data['setpoint']
|
self._target_temperature = data['setpoint']
|
||||||
self._name = data['name']
|
if data['thermostat'] == "DOMESTIC_HOT_WATER":
|
||||||
|
self._name = "Hot Water"
|
||||||
|
self._is_dhw = True
|
||||||
|
else:
|
||||||
|
self._name = data['name']
|
||||||
|
self._is_dhw = False
|
||||||
|
|
Loading…
Add table
Reference in a new issue