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 geniushub to new climate schema #24191

Merged
merged 67 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
a814484
Update one
pvizeli May 14, 2019
f86cd6a
Fix model climate v2
pvizeli May 15, 2019
3cb4ff8
Cleanup p4
pvizeli May 16, 2019
d16dff9
Add comfort hold mode
pvizeli May 16, 2019
ba3d424
Fix old code
pvizeli May 16, 2019
9be6768
Update homeassistant/components/climate/__init__.py
pvizeli May 16, 2019
5c5fc38
Update homeassistant/components/climate/const.py
pvizeli May 16, 2019
deb86e5
First renaming
pvizeli May 16, 2019
1e6e2ec
Rename operation to hvac for paulus
pvizeli May 16, 2019
17ce0ae
Rename hold mode to preset mode
pvizeli May 16, 2019
dbb8aa4
Cleanup & update comments
pvizeli May 17, 2019
f6d77d6
Remove on/off
pvizeli May 17, 2019
0d07e22
Fix supported feature count
pvizeli May 17, 2019
af95d75
Update services
pvizeli May 17, 2019
e0097c1
Update demo
pvizeli May 17, 2019
cfecfbd
Fix tests & use current_hvac
pvizeli May 20, 2019
d2bcee3
Update comment
pvizeli May 20, 2019
72fa8b9
Fix tests & add typing
pvizeli May 20, 2019
3d1917b
Add more typing
pvizeli May 20, 2019
e921252
Update modes
pvizeli May 20, 2019
151a6c4
Fix tests
pvizeli May 20, 2019
fb85e9a
Cleanup low/high with range
pvizeli May 20, 2019
d964eab
Update homematic part 1
pvizeli May 20, 2019
1fdf810
Finish homematic
pvizeli May 20, 2019
e52a1bc
Fix lint
pvizeli May 21, 2019
9ccd1e8
fix hm mapping
pvizeli May 21, 2019
41376cd
Support simple devices
pvizeli May 21, 2019
8a091d5
convert lcn
pvizeli May 22, 2019
1e8d74f
migrate oem
pvizeli May 22, 2019
fe7794a
Fix xs1
pvizeli May 22, 2019
32efc21
update hive
pvizeli May 22, 2019
e241f56
update mil
pvizeli May 22, 2019
0d20645
Update toon
pvizeli May 22, 2019
772b07e
migrate deconz
pvizeli May 22, 2019
88bcce1
cleanup
pvizeli May 22, 2019
1083cd7
update tesla
pvizeli May 22, 2019
110ca3d
Fix lint
pvizeli May 23, 2019
dfe8902
Fix vera
pvizeli May 23, 2019
b92ec04
Migrate zwave
pvizeli May 23, 2019
84c98a0
Migrate velbus
pvizeli May 23, 2019
9af2fd1
Cleanup humity feature
pvizeli May 23, 2019
a8d538b
Cleanup
pvizeli May 24, 2019
4b1495f
Migrate wink
pvizeli May 24, 2019
6aacd16
migrate dyson
pvizeli May 27, 2019
9c546b7
Fix current hvac
pvizeli May 27, 2019
2bdfa0b
Renaming
pvizeli May 27, 2019
65d183a
Fix lint
pvizeli May 27, 2019
eb049b2
Migrate tfiac
pvizeli May 27, 2019
abfd323
migrate tado
pvizeli May 29, 2019
fec87c5
delinted
zxdavb May 29, 2019
64929c8
use latest client
zxdavb May 29, 2019
1b72af5
clean up mappings
zxdavb May 29, 2019
798350b
add duration to set_temperature
zxdavb May 30, 2019
110d80f
delinted
zxdavb May 29, 2019
22de487
clean up mappings
zxdavb May 29, 2019
fe38786
add duration to set_temperature
zxdavb May 30, 2019
97e6b61
manual rebase
zxdavb Jul 2, 2019
7913210
tweak
zxdavb Jul 2, 2019
2f6bfb9
fix regression
zxdavb Jul 2, 2019
f3210eb
small fix
zxdavb Jul 2, 2019
3f45d98
fix rebase mixup
zxdavb Jul 2, 2019
fa0c916
address comments
zxdavb Jul 3, 2019
64e884c
finish refactor
zxdavb Jul 3, 2019
3c499b8
fix regression
zxdavb Jul 3, 2019
dbd20d7
tweak type hints
zxdavb Jul 3, 2019
c609600
delint
zxdavb Jul 3, 2019
f0f1b9e
manual rebase
zxdavb Jul 4, 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
manual rebase
  • Loading branch information
zxdavb committed Jul 4, 2019
commit 97e6b617e679e92a953e9b4a88d095b1920407e8
69 changes: 48 additions & 21 deletions homeassistant/components/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_STEP, DOMAIN, HVAC_MODES,
SERVICE_SET_AUX_HEAT, SERVICE_SET_FAN_MODE, SERVICE_SET_PRESET_MODE,
SERVICE_SET_HUMIDITY, SERVICE_SET_HVAC_MODE, SERVICE_SET_SWING_MODE,
SERVICE_SET_TEMPERATURE, SUPPORT_AUX_HEAT, SUPPORT_HVAC_ACTION,
SERVICE_SET_TEMPERATURE, SUPPORT_AUX_HEAT,
SUPPORT_FAN_MODE, SUPPORT_PRESET_MODE, SUPPORT_SWING_MODE,
SUPPORT_TARGET_HUMIDITY, SUPPORT_TARGET_TEMPERATURE_RANGE)
from .reproduce_state import async_reproduce_states # noqa
Expand Down Expand Up @@ -70,7 +70,7 @@
})
SET_PRESET_MODE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
vol.Required(ATTR_PRESET_MODE): cv.string,
vol.Required(ATTR_PRESET_MODE): vol.Maybe(cv.string),
})
SET_HVAC_MODE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
Expand Down Expand Up @@ -192,7 +192,7 @@ def state_attributes(self) -> Dict[str, Any]:
data[ATTR_FAN_MODE] = self.fan_mode
data[ATTR_FAN_MODES] = self.fan_modes

if supported_features & SUPPORT_HVAC_ACTION:
if self.hvac_action:
data[ATTR_HVAC_ACTIONS] = self.hvac_action

if supported_features & SUPPORT_PRESET_MODE:
Expand Down Expand Up @@ -264,48 +264,75 @@ def target_temperature_step(self) -> Optional[float]:

@property
def target_temperature_high(self) -> Optional[float]:
"""Return the highbound target temperature we try to reach."""
return None
"""Return the highbound target temperature we try to reach.

Requires SUPPORT_TARGET_TEMPERATURE_RANGE.
"""
raise NotImplementedError

@property
def target_temperature_low(self) -> Optional[float]:
"""Return the lowbound target temperature we try to reach."""
return None
"""Return the lowbound target temperature we try to reach.

Requires SUPPORT_TARGET_TEMPERATURE_RANGE.
"""
raise NotImplementedError

@property
def preset_mode(self) -> Optional[str]:
"""Return the current preset mode, e.g., home, away, temp."""
return None
"""Return the current preset mode, e.g., home, away, temp.

Requires SUPPORT_PRESET_MODE.
"""
raise NotImplementedError

@property
def preset_modes(self) -> Optional[List[str]]:
"""Return a list of available preset modes."""
return None
"""Return a list of available preset modes.

Requires SUPPORT_PRESET_MODE.
"""
raise NotImplementedError

@property
def is_aux_heat(self) -> Optional[str]:
"""Return true if aux heater."""
return None
"""Return true if aux heater.

Requires SUPPORT_AUX_HEAT.
"""
raise NotImplementedError

@property
def fan_mode(self) -> Optional[str]:
"""Return the fan setting."""
return None
"""Return the fan setting.

Requires SUPPORT_FAN_MODE.
"""
raise NotImplementedError

@property
def fan_modes(self) -> Optional[List[str]]:
"""Return the list of available fan modes."""
return None
"""Return the list of available fan modes.

Requires SUPPORT_FAN_MODE.
"""
raise NotImplementedError

@property
def swing_mode(self) -> Optional[str]:
"""Return the fan setting."""
return None
"""Return the swing setting.

Requires SUPPORT_SWING_MODE.
"""
raise NotImplementedError

@property
def swing_modes(self) -> Optional[List[str]]:
"""Return the list of available swing modes."""
return None
"""Return the list of available swing modes.

Requires SUPPORT_SWING_MODE.
"""
raise NotImplementedError

def set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
Expand Down
3 changes: 0 additions & 3 deletions homeassistant/components/deconz/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ async def async_setup_platform(
SUPPORT_HVAC = HVAC_MODE_HEAT | HVAC_MODE_OFF


SUPPORT_HVAC = HVAC_MODE_HEAT | HVAC_MODE_OFF


async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the deCONZ climate devices.

Expand Down
103 changes: 81 additions & 22 deletions homeassistant/components/demo/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,93 @@
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, CURRENT_HVAC_COOL,
CURRENT_HVAC_HEAT, HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_HEAT,
HVAC_MODE_HEAT_COOL, HVAC_MODE_OFF, HVAC_MODES, SUPPORT_AUX_HEAT,
SUPPORT_HVAC_ACTION, SUPPORT_FAN_MODE, SUPPORT_PRESET_MODE,
SUPPORT_SWING_MODE, SUPPORT_TARGET_HUMIDITY, SUPPORT_TARGET_HUMIDITY_RANGE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE_RANGE)
SUPPORT_FAN_MODE, SUPPORT_PRESET_MODE, SUPPORT_SWING_MODE,
SUPPORT_TARGET_HUMIDITY, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT

SUPPORT_FLAGS = SUPPORT_TARGET_HUMIDITY_RANGE
SUPPORT_FLAGS = 0


def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Demo climate devices."""
add_entities([
DemoClimate('HeatPump', 68, TEMP_FAHRENHEIT, None, 77,
None, None, None, None, HVAC_MODE_AUTO,
CURRENT_HVAC_HEAT, None, None, None,
[HVAC_MODE_HEAT, HVAC_MODE_OFF]),
DemoClimate('Hvac', 21, TEMP_CELSIUS, None, 22, 'On High',
67, 54, 'Off', HVAC_MODE_COOL, CURRENT_HVAC_COOL,
False, None, None, HVAC_MODES),
DemoClimate('Ecobee', None, TEMP_CELSIUS, 'home', 23, 'Auto Low',
None, None, 'Auto', HVAC_MODE_HEAT_COOL, None, None, 24,
21, [HVAC_MODE_AUTO, HVAC_MODE_HEAT_COOL, HVAC_MODE_COOL,
HVAC_MODE_HEAT])
DemoClimate(
name='HeatPump',
target_temperature=68,
unit_of_measurement=TEMP_FAHRENHEIT,
preset=None,
current_temperature=77,
fan_mode=None,
target_humidity=None,
current_humidity=None,
swing_mode=None,
hvac_mode=HVAC_MODE_HEAT,
hvac_action=CURRENT_HVAC_HEAT,
aux=None,
target_temp_high=None,
target_temp_low=None,
hvac_modes=[HVAC_MODE_HEAT, HVAC_MODE_OFF]
),
DemoClimate(
name='Hvac',
target_temperature=21,
unit_of_measurement=TEMP_CELSIUS,
preset=None,
current_temperature=22,
fan_mode='On High',
target_humidity=67,
current_humidity=54,
swing_mode='Off',
hvac_mode=HVAC_MODE_COOL,
hvac_action=CURRENT_HVAC_COOL,
aux=False,
target_temp_high=None,
target_temp_low=None,
hvac_modes=HVAC_MODES
),
DemoClimate(
name='Ecobee',
target_temperature=None,
unit_of_measurement=TEMP_CELSIUS,
preset='home',
preset_modes=['home', 'eco'],
current_temperature=23,
fan_mode='Auto Low',
target_humidity=None,
current_humidity=None,
swing_mode='Auto',
hvac_mode=HVAC_MODE_HEAT_COOL,
hvac_action=None,
aux=None,
target_temp_high=24,
target_temp_low=21,
hvac_modes=[HVAC_MODE_AUTO, HVAC_MODE_HEAT_COOL, HVAC_MODE_COOL,
HVAC_MODE_HEAT])
])


class DemoClimate(ClimateDevice):
"""Representation of a demo climate device."""

def __init__(
self, name, target_temperature, unit_of_measurement, preset,
current_temperature, fan_mode, target_humidity, current_humidity,
swing_mode, hvac_mode, hvac_action, aux, target_temp_high,
target_temp_low, hvac_modes
self,
name,
target_temperature,
unit_of_measurement,
preset,
current_temperature,
fan_mode,
target_humidity,
current_humidity,
swing_mode,
hvac_mode,
hvac_action,
aux,
target_temp_high,
target_temp_low,
hvac_modes,
preset_modes=None,
):
"""Initialize the climate device."""
self._name = name
Expand All @@ -54,8 +108,7 @@ def __init__(
if swing_mode is not None:
self._support_flags = self._support_flags | SUPPORT_SWING_MODE
if hvac_action is not None:
self._support_flags = \
self._support_flags | SUPPORT_HVAC_ACTION
self._support_flags = self._support_flags
if aux is not None:
self._support_flags = self._support_flags | SUPPORT_AUX_HEAT
if target_temp_high is not None and target_temp_low is not None:
Expand All @@ -65,6 +118,7 @@ def __init__(
self._target_humidity = target_humidity
self._unit_of_measurement = unit_of_measurement
self._preset = preset
self._preset_modes = preset_modes
self._current_temperature = current_temperature
self._current_humidity = current_humidity
self._current_fan_mode = fan_mode
Expand Down Expand Up @@ -150,9 +204,14 @@ def hvac_modes(self):

@property
def preset_mode(self):
"""Return hold mode setting."""
"""Return preset mode."""
return self._preset

@property
def preset_modes(self):
"""Return preset modes."""
return self._preset_modes

@property
def is_aux_heat(self):
"""Return true if aux heat is on."""
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/dyson/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, HVAC_MODE_COOL,
HVAC_MODE_HEAT, SUPPORT_HVAC_ACTION, SUPPORT_FAN_MODE, FAN_FOCUS,
HVAC_MODE_HEAT, SUPPORT_FAN_MODE, FAN_FOCUS,
FAN_DIFFUSE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS

Expand All @@ -18,8 +18,7 @@

SUPPORT_FAN = [FAN_FOCUS, FAN_DIFFUSE]
SUPPORT_HVAG = [HVAC_MODE_COOL, HVAC_MODE_HEAT]
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE |
SUPPORT_HVAC_ACTION)
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE


def setup_platform(hass, config, add_devices, discovery_info=None):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/geniushub/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Genius Hub",
"documentation": "https://www.home-assistant.io/components/geniushub",
"requirements": [
"geniushub-client==0.4.11"
"geniushub-client==0.4.12"
],
"dependencies": [],
"codeowners": ["@zxdavb"]
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/honeywell/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
from homeassistant.components.climate.const import (
ATTR_FAN_MODE, ATTR_FAN_MODES,
ATTR_OPERATION_MODE, ATTR_OPERATION_LIST, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_AWAY_MODE, SUPPORT_OPERATION_MODE)
ATTR_HVAC_MODE, ATTR_OPERATION_LIST, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_AWAY_MODE)
from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT,
ATTR_TEMPERATURE, CONF_REGION)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lcn/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, config, address_connection):

self._current_temperature = None
self._target_temperature = None
self._is_on = True
self._is_on = None

async def async_added_to_hass(self):
"""Run when entity about to be added to hass."""
Expand Down
9 changes: 4 additions & 5 deletions homeassistant/components/mill/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
DOMAIN, HVAC_MODE_HEAT, HVAC_MODE_OFF, SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE)
SUPPORT_TARGET_TEMPERATURE, FAN_ON)
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_PASSWORD, CONF_USERNAME, STATE_OFF, STATE_ON,
TEMP_CELSIUS)
ATTR_TEMPERATURE, CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS)
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession

Expand Down Expand Up @@ -143,7 +142,7 @@ def fan_mode(self):
@property
def fan_modes(self):
"""List of available fan modes."""
return [STATE_ON, STATE_OFF]
return [FAN_ON, HVAC_MODE_OFF]

@property
def min_temp(self):
Expand Down Expand Up @@ -185,7 +184,7 @@ async def async_set_temperature(self, **kwargs):

async def async_set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
fan_status = 1 if fan_mode == STATE_ON else 0
fan_status = 1 if fan_mode == FAN_ON else 0
await self._conn.heater_control(
self._heater.device_id, fan_status=fan_status)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nest/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, structure, device, temp_unit):
self._unit = temp_unit
self.structure = structure
self.device = device
self._fan_modes = [STATE_ON, STATE_AUTO]
self._fan_modes = [FAN_ON, FAN_AUTO]

# Set the default supported features
self._support_flags = (SUPPORT_TARGET_TEMPERATURE |
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/oem/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, CURRENT_HVAC_OFF, HVAC_MODE_AUTO,
HVAC_MODE_HEAT, HVAC_MODE_OFF, SUPPORT_HVAC_ACTION,
SUPPORT_TARGET_TEMPERATURE)
HVAC_MODE_HEAT, HVAC_MODE_OFF, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_PORT,
CONF_USERNAME, TEMP_CELSIUS)
Expand All @@ -26,7 +25,7 @@
vol.Inclusive(CONF_PASSWORD, 'authentication'): cv.string,
})

SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_HVAC_ACTION
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE
SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]


Expand Down
Loading