Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate evohome, cache access tokens #24491

Merged
merged 29 commits into from
Jul 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c4a6102
add water_heater, add storage - initial commit
zxdavb Jun 12, 2019
a1eb8c7
Add Broker, Water Heater & Refactor
zxdavb Jun 12, 2019
9314760
update honeywell client library & CODEOWNER
zxdavb Jun 12, 2019
1d45132
add water_heater, add storage - initial commit
zxdavb Jun 12, 2019
0bae299
bugfix - loc_idx may not be 0
zxdavb Jun 16, 2019
014bf39
support RoundThermostat
zxdavb Jun 19, 2019
3cf5755
store at_expires as naive UTC
zxdavb Jun 30, 2019
fdaec4b
update CODEOWNERS
zxdavb Jul 1, 2019
8502a0c
fix regression
zxdavb Jul 1, 2019
9f19f87
fix requirements
zxdavb Jul 3, 2019
dfe58ec
migrate to climate-1.0
zxdavb Jul 3, 2019
6a56b29
tweaking
zxdavb Jul 3, 2019
81762c4
de-lint
zxdavb Jul 4, 2019
7461550
TCS working? & delint
zxdavb Jul 4, 2019
adc00ca
tweaking
zxdavb Jul 4, 2019
9fdccfd
TCS code finalised
zxdavb Jul 5, 2019
3ce7db5
remove available() logic
zxdavb Jul 5, 2019
1e9f109
refactor _switchpoints()
zxdavb Jul 5, 2019
e72a7b2
tidy up switchpoint code
zxdavb Jul 6, 2019
5d79731
tweak
zxdavb Jul 6, 2019
ee0f5fb
teaking device_state_attributes
zxdavb Jul 6, 2019
9f945fd
some refactoring
zxdavb Jul 6, 2019
5d188a9
move PRESET_CUSTOM back to evohome
zxdavb Jul 6, 2019
87eb2c3
move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
zxdavb Jul 6, 2019
457fa12
refactor SP code and dt conversion
zxdavb Jul 6, 2019
90eae21
delinted
zxdavb Jul 6, 2019
9bc75f6
delinted
zxdavb Jul 6, 2019
426b839
remove water_heater
zxdavb Jul 6, 2019
4156f71
fix regression
zxdavb Jul 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove available() logic
  • Loading branch information
zxdavb committed Jul 6, 2019
commit 3ce7db5f3a77db888787e69861d23944a7463d80
6 changes: 0 additions & 6 deletions homeassistant/components/evohome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ def __init__(self, evo_broker, evo_device) -> None:

self._name = self._icon = self._precision = None
self._state_attributes = self._supported_features = None
self._available = False # should become True after first update()

@callback
def _refresh(self, packet):
Expand Down Expand Up @@ -278,11 +277,6 @@ def icon(self) -> str:
"""Return the icon to use in the frontend UI."""
return self._icon

@property
def available(self) -> bool:
"""Return True if the device is currently available."""
return self._available

@property
def supported_features(self) -> int:
"""Get the flag of supported features of the device."""
Expand Down
46 changes: 21 additions & 25 deletions homeassistant/components/evohome/climate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for Climate devices of (EMEA/EU-based) Honeywell TCC systems."""
from datetime import datetime, timedelta
import logging
from typing import Any, Awaitable, Dict, Optional, List

Expand Down Expand Up @@ -117,7 +118,7 @@ def __init__(self, evo_broker, evo_device) -> None:
self._hvac_modes = list(HA_HVAC_TO_ZONE)
self._preset_modes = list(HA_PRESET_TO_ZONE)

@property # TODO: finished
@property # TODO: check
def hvac_mode(self) -> str:
"""Return the current operating mode of the evohome Zone.

Expand All @@ -142,60 +143,63 @@ def hvac_mode(self) -> str:
return HVAC_MODE_AUTO

is_off = self.target_temperature == self.min_temp
# _LOGGER.warn("hvac_mode(Zone=%s): B %s", self._id, HVAC_MODE_OFF if is_off else HVAC_MODE_HEAT)
# _LOGGER.warn("hvac_mode(Zone=%s): B %s", self._id, HVAC_MODE_OFF if is_off else HVAC_MODE_HEAT)
return HVAC_MODE_OFF if is_off else HVAC_MODE_HEAT

@property # TODO: finished
@property # TODO: check
def current_temperature(self) -> Optional[float]:
"""Return the current temperature of the evohome Zone."""
return (self._evo_device.temperatureStatus['temperature']
if self._evo_device.temperatureStatus['isAvailable'] else None)

@property # TODO: finished
@property # TODO: check
def target_temperature(self) -> Optional[float]:
"""Return the target temperature of the evohome Zone."""
return self._evo_device.setpointStatus['targetHeatTemperature']

@property
@property # TODO: check
def preset_mode(self) -> Optional[str]:
"""Return the current preset mode, e.g., home, away, temp."""
# _LOGGER.warn("preset_mode(Zone=%s): %s", self._id, 'auto')
# _LOGGER.warn("preset_mode(Zone=%s): %s", self._id, 'auto')
return 'auto'

@property # TODO: finished
@property
def min_temp(self) -> float:
"""Return the minimum target temperature of a evohome Zone.

The default is 5, but it is configurable within 5-35 (in Celsius).
The default is 5, but is user-configurable within 5-35 (in Celsius).
"""
return self._evo_device.setpointCapabilities['minHeatSetpoint']

@property # TODO: finished
@property
def max_temp(self) -> float:
"""Return the maximum target temperature of a evohome Zone.

The default is 35, but it is configurable within 5-35 (in Celsius).
The default is 35, but is user-configurable within 5-35 (in Celsius).
"""
return self._evo_device.setpointCapabilities['maxHeatSetpoint']

def _set_temperature(self, temperature, until=None):
def _set_temperature(self, temperature, until=None): # TODO: check
"""Set the new target temperature of a Zone.

temperature is required, until can be:
- strftime('%Y-%m-%dT%H:%M:%SZ') for TemporaryOverride, or
- None for PermanentOverride (i.e. indefinitely)
"""
if type(until) == datetime:
until = until.strftime('%Y-%m-%dT%H:%M:%SZ')
try:
self._evo_device.set_temperature(temperature, until)
except (requests.exceptions.RequestException,
evohomeclient2.AuthenticationError) as err:
_handle_exception(err)

def set_temperature(self, **kwargs) -> None:
"""Set a new target temperature, indefinitely."""
self._set_temperature(kwargs['temperature'], until=None)
def set_temperature(self, **kwargs) -> None: # TODO: check
"""Set a new target temperature for an hour."""
until = kwargs.get('until', datetime.now() + timedelta(hours=1))
self._set_temperature(kwargs['temperature'], until=until)

def _set_operation_mode(self, op_mode) -> None:
def _set_operation_mode(self, op_mode) -> None: # TODO: check
"""Set the Zone to any of its native EVO_* operating modes."""
if op_mode == EVO_FOLLOW:
try:
Expand All @@ -211,7 +215,7 @@ def _set_operation_mode(self, op_mode) -> None:
evohomeclient2.AuthenticationError) as err:
_handle_exception(err)

def set_hvac_mode(self, hvac_mode: str) -> None: # TODO: finished
def set_hvac_mode(self, hvac_mode: str) -> None: # TODO: check
"""Set an operating mode for the Zone."""
if hvac_mode == HVAC_MODE_OFF:
self._set_temperature(self.min_temp, until=None)
Expand All @@ -220,14 +224,10 @@ def set_hvac_mode(self, hvac_mode: str) -> None: # TODO: finished
else:
self._set_operation_mode(HA_HVAC_TO_ZONE.get(hvac_mode))

def set_preset_mode(self, preset_mode: str) -> None:
def set_preset_mode(self, preset_mode: str) -> None: # TODO: check
"""Set new preset mode."""
self._set_operation_mode(preset_mode)

async def async_update(self) -> Awaitable[None]: # TODO: finished
"""Process the evohome Zone's state data."""
self._available = self._evo_device.temperatureStatus['isAvailable']


class EvoController(EvoClimateDevice):
"""Base for a Honeywell evohome Controller (hub).
Expand Down Expand Up @@ -322,7 +322,3 @@ def set_hvac_mode(self, hvac_mode: str) -> None:
def set_preset_mode(self, preset_mode: str) -> None:
"""Set a new preset mode."""
self._set_operation_mode(HA_PRESET_TO_TCS.get(preset_mode, EVO_AUTO))

async def async_update(self) -> Awaitable[None]:
"""Process the evohome Controller's state data."""
self._available = True
4 changes: 0 additions & 4 deletions homeassistant/components/evohome/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,3 @@ def set_operation_mode(self, operation_mode: str) -> None:
except (requests.exceptions.RequestException,
evohomeclient2.AuthenticationError) as err:
_handle_exception(err)

async def async_update(self) -> Awaitable[None]:
"""Process the evohome DHW controller's state data."""
self._available = self._evo_device.temperatureStatus['isAvailable']