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

Climate 1.0 #23899

Merged
merged 92 commits into from Jul 8, 2019
Merged

Climate 1.0 #23899

Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
fa0fa7b
Climate 1.0 / part 1/2/3
pvizeli May 14, 2019
f7ddeeb
fix flake
pvizeli Jul 2, 2019
3cf4152
Lint
balloob Jul 2, 2019
b528df5
Update Google Assistant
balloob Jul 2, 2019
6f258ea
ambiclimate to climate 1.0 (#24911)
Danielhiversen Jul 2, 2019
4039f63
Fix Alexa
balloob Jul 2, 2019
2f4302f
Lint
balloob Jul 2, 2019
93ef963
Migrate zhong_hong
balloob Jul 2, 2019
83a2ae1
Migrate tuya
balloob Jul 2, 2019
fe34f0d
Migrate honeywell to new climate schema (#24257)
zxdavb Jul 2, 2019
5c5bae7
Migrate radiotherm
balloob Jul 2, 2019
8e3635d
Convert touchline
balloob Jul 2, 2019
c190d09
Migrate flexit
balloob Jul 2, 2019
320c871
Migrate nuheat
balloob Jul 2, 2019
c8e5498
Migrate maxcube
balloob Jul 2, 2019
e9bbb83
Fix names maxcube const
balloob Jul 2, 2019
d2e9b63
Migrate proliphix
balloob Jul 2, 2019
c60a242
Migrate heatmiser
balloob Jul 2, 2019
bcc1d2d
Migrate fritzbox
balloob Jul 2, 2019
287608c
Migrate opentherm_gw
balloob Jul 3, 2019
73b7a9d
Migrate venstar
balloob Jul 3, 2019
d0e457a
Migrate daikin
Swamp-Ig Jul 3, 2019
7a0eb74
Migrate modbus
balloob Jul 3, 2019
4ebd613
Fix elif
balloob Jul 3, 2019
34fff85
Migrate Homematic IP Cloud to climate-1.0 (#24913)
SukramJ Jul 3, 2019
4900729
Migrate generic_thermostat
pvizeli Jul 3, 2019
1aa54b6
Merge branch 'climate-1.0' of https://github.com/home-assistant/home-…
pvizeli Jul 3, 2019
cea306b
Migrate incomfort to new climate schema (#24915)
zxdavb Jul 3, 2019
752dee1
Migrate eq3btsmart
pvizeli Jul 3, 2019
953c2ac
Merge branch 'climate-1.0' of https://github.com/home-assistant/home-…
pvizeli Jul 3, 2019
a536cc3
Lint
balloob Jul 3, 2019
31fe4a9
cleanup PRESET_MANUAL
pvizeli Jul 3, 2019
bfd3794
Migrate ecobee
balloob Jul 3, 2019
52910c9
No conditional features
balloob Jul 3, 2019
ce3dc7a
KNX: Migrate climate component to new climate platform (#24931)
marvin-w Jul 3, 2019
f01887b
Lint
balloob Jul 3, 2019
2f3072b
fix tests
pvizeli Jul 4, 2019
5a8580a
Fix value
pvizeli Jul 4, 2019
8f22c9c
Migrate geniushub to new climate schema (#24191)
zxdavb Jul 4, 2019
23d3ce1
WIP: Fixes for honeywell migration to climate-1.0 (#24938)
zxdavb Jul 4, 2019
da94554
Fixes for incomfort migration to climate-1.0 (#24936)
zxdavb Jul 5, 2019
f8ca4cc
Fix homekit_controller on climate-1.0 (#24948)
Jc2k Jul 5, 2019
80f4276
lint
balloob Jul 5, 2019
be93844
Fix imports
balloob Jul 5, 2019
4faf1d1
Migrate stibel_eltron
pvizeli Jul 5, 2019
99db0b8
Merge branch 'climate-1.0' of https://github.com/home-assistant/home-…
pvizeli Jul 5, 2019
705aa83
Fix lint
pvizeli Jul 5, 2019
42d3d12
Migrate coolmaster to climate 1.0 (#24967)
OnFreund Jul 5, 2019
c81215b
Fix demo to work with UI
balloob Jul 5, 2019
c5e4469
Migrate spider
pvizeli Jul 5, 2019
e6e39bc
Demo update
balloob Jul 5, 2019
d61e244
Updated frontend to 20190705.0
balloob Jul 5, 2019
6bdee22
Merge remote-tracking branch 'origin/dev' into climate-1.0
balloob Jul 5, 2019
99ecc65
Fix boost mode (#24980)
SukramJ Jul 6, 2019
0d34dc9
Prepare Netatmo for climate 1.0 (#24973)
cgtobi Jul 6, 2019
51f0469
Migrate ephember
balloob Jul 6, 2019
d6ed6e8
Migrate Sensibo
balloob Jul 6, 2019
f13072b
Implemented review comments (#24942)
marvin-w Jul 6, 2019
b2a470d
Migrate ESPHome
balloob Jul 6, 2019
644e440
Migrate MQTT
balloob Jul 6, 2019
363c883
Migrate Nest
balloob Jul 6, 2019
39232b8
Migrate melissa
balloob Jul 6, 2019
cc8340e
Initial/partial migration of ST
andrewsayre Jul 6, 2019
79e7dad
Merge branch 'climate-1.0' of https://github.com/home-assistant/home-…
andrewsayre Jul 6, 2019
3ac81e0
Migrate ST
andrewsayre Jul 6, 2019
69578da
Remove Away mode (#24995)
SukramJ Jul 7, 2019
63bbb85
Migrate evohome, cache access tokens (#24491)
zxdavb Jul 7, 2019
873f953
Migrate homekit
pvizeli Jul 7, 2019
a5f8f65
Cleanup away mode
pvizeli Jul 7, 2019
0d82f07
Fix tests
pvizeli Jul 7, 2019
7fd7092
add helpers
pvizeli Jul 7, 2019
f094d37
fix tests melissa
pvizeli Jul 7, 2019
de17b1b
Fix nehueat
pvizeli Jul 7, 2019
6d9d31e
fix zwave
pvizeli Jul 7, 2019
3bf8029
add more tests
pvizeli Jul 7, 2019
1dca06c
fix deconz
pvizeli Jul 7, 2019
686e145
Fix climate test emulate_hue
pvizeli Jul 7, 2019
a078b04
fix tests
pvizeli Jul 7, 2019
94dd612
fix dyson tests
pvizeli Jul 7, 2019
7a4b18e
fix demo with new layout
pvizeli Jul 7, 2019
d2bbffc
fix honeywell
pvizeli Jul 7, 2019
d289258
Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_…
Jc2k Jul 7, 2019
a233b77
Lint
balloob Jul 7, 2019
aa4c645
PyLint
balloob Jul 7, 2019
60bb29f
Pylint
balloob Jul 7, 2019
4253617
fix fritzbox tests
pvizeli Jul 8, 2019
3345f10
Fix google
pvizeli Jul 8, 2019
7c0e954
Fix all tests
pvizeli Jul 8, 2019
fcd9033
Fix lint
pvizeli Jul 8, 2019
0212e2c
Fix auto for homekit like controler
pvizeli Jul 8, 2019
d28b44d
Fix lint
pvizeli Jul 8, 2019
c716ee2
fix lint
pvizeli Jul 8, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -18,6 +18,7 @@
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"files.trimTrailingWhitespace": true,
"editor.rulers": [80]
"editor.rulers": [80],
"terminal.integrated.shell.linux": "/bin/bash"
}
}
@@ -94,7 +94,10 @@ virtualization/vagrant/.vagrant
virtualization/vagrant/config

# Visual Studio Code
.vscode
.vscode/*
!.vscode/cSpell.json
!.vscode/extensions.json
!.vscode/tasks.json

# Built docs
docs/build
@@ -0,0 +1,92 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Preview",
"type": "shell",
"command": "hass -c ./config",
"group": {
"kind": "test",
"isDefault": true,
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Pytest",
"type": "shell",
"command": "pytest --timeout=10 tests",
"group": {
"kind": "test",
"isDefault": true,
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Flake8",
"type": "shell",
"command": "flake8 homeassistant tests",
"group": {
"kind": "test",
"isDefault": true,
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Pylint",
"type": "shell",
"command": "pylint homeassistant",
"dependsOn": [
"Install all Requirements"
],
"group": {
"kind": "test",
"isDefault": true,
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Generate Requirements",
"type": "shell",
"command": "./script/gen_requirements_all.py",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Install all Requirements",
"type": "shell",
"command": "pip3 install -r requirements_all.txt -c homeassistant/package_constraints.txt",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}
@@ -23,6 +23,7 @@
from .const import (
API_TEMP_UNITS,
API_THERMOSTAT_MODES,
API_THERMOSTAT_PRESETS,
DATE_FORMAT,
PERCENTAGE_FAN_MAP,
)
@@ -180,9 +181,13 @@ def get_property(self, name):
if name != 'powerState':
raise UnsupportedProperty(name)

if self.entity.state == STATE_OFF:
return 'OFF'
return 'ON'
if self.entity.domain == climate.DOMAIN:
is_on = self.entity.state != climate.HVAC_MODE_OFF

else:
is_on = self.entity.state != STATE_OFF

return 'ON' if is_on else 'OFF'


class AlexaLockController(AlexaCapibility):
@@ -546,16 +551,13 @@ def name(self):

def properties_supported(self):
"""Return what properties this entity supports."""
properties = []
properties = [{'name': 'thermostatMode'}]
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if supported & climate.SUPPORT_TARGET_TEMPERATURE:
properties.append({'name': 'targetSetpoint'})
if supported & climate.SUPPORT_TARGET_TEMPERATURE_LOW:
if supported & climate.SUPPORT_TARGET_TEMPERATURE_RANGE:
properties.append({'name': 'lowerSetpoint'})
if supported & climate.SUPPORT_TARGET_TEMPERATURE_HIGH:
properties.append({'name': 'upperSetpoint'})
if supported & climate.SUPPORT_OPERATION_MODE:
properties.append({'name': 'thermostatMode'})
return properties

def properties_proactively_reported(self):
@@ -569,13 +571,18 @@ def properties_retrievable(self):
def get_property(self, name):
"""Read and return a property."""
if name == 'thermostatMode':
ha_mode = self.entity.attributes.get(climate.ATTR_OPERATION_MODE)
mode = API_THERMOSTAT_MODES.get(ha_mode)
if mode is None:
_LOGGER.error("%s (%s) has unsupported %s value '%s'",
self.entity.entity_id, type(self.entity),
climate.ATTR_OPERATION_MODE, ha_mode)
raise UnsupportedProperty(name)
preset = self.entity.attributes.get(climate.ATTR_PRESET_MODE)

if preset in API_THERMOSTAT_PRESETS:
mode = API_THERMOSTAT_PRESETS[preset]
else:
mode = API_THERMOSTAT_MODES.get(self.entity.state)
if mode is None:
_LOGGER.error(
"%s (%s) has unsupported state value '%s'",
self.entity.entity_id, type(self.entity),
self.entity.state)
raise UnsupportedProperty(name)
return mode

unit = self.hass.config.units.temperature_unit
@@ -2,7 +2,6 @@
from collections import OrderedDict

from homeassistant.const import (
STATE_OFF,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
@@ -57,16 +56,17 @@
# reverse mapping of this dict and we want to map the first occurrance of OFF
# back to HA state.
API_THERMOSTAT_MODES = OrderedDict([
(climate.STATE_HEAT, 'HEAT'),
(climate.STATE_COOL, 'COOL'),
(climate.STATE_AUTO, 'AUTO'),
(climate.STATE_ECO, 'ECO'),
(climate.STATE_MANUAL, 'AUTO'),
(STATE_OFF, 'OFF'),
(climate.STATE_IDLE, 'OFF'),
(climate.STATE_FAN_ONLY, 'OFF'),
(climate.STATE_DRY, 'OFF'),
(climate.HVAC_MODE_HEAT, 'HEAT'),
(climate.HVAC_MODE_COOL, 'COOL'),
(climate.HVAC_MODE_HEAT_COOL, 'AUTO'),
(climate.HVAC_MODE_AUTO, 'AUTO'),
(climate.HVAC_MODE_OFF, 'OFF'),
(climate.HVAC_MODE_FAN_ONLY, 'OFF'),
(climate.HVAC_MODE_DRY, 'OFF'),
])
API_THERMOSTAT_PRESETS = {
climate.PRESET_ECO: 'ECO'
}

PERCENTAGE_FAN_MAP = {
fan.SPEED_LOW: 33,
@@ -248,9 +248,11 @@ def default_display_categories(self):

def interfaces(self):
"""Yield the supported interfaces."""
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if supported & climate.SUPPORT_ON_OFF:
# If we support two modes, one being off, we allow turning on too.
if len([v for v in self.entity.attributes[climate.ATTR_HVAC_MODES]
if v != climate.HVAC_MODE_OFF]) == 1:
yield AlexaPowerController(self.entity)

yield AlexaThermostatController(self.hass, self.entity)
yield AlexaTemperatureSensor(self.hass, self.entity)
yield AlexaEndpointHealth(self.hass, self.entity)
@@ -33,6 +33,7 @@
from .const import (
API_TEMP_UNITS,
API_THERMOSTAT_MODES,
API_THERMOSTAT_PRESETS,
Cause,
)
from .entities import async_get_entities
@@ -686,23 +687,45 @@ def temperature_from_object(hass, temp_obj, interval=False):
mode = directive.payload['thermostatMode']
mode = mode if isinstance(mode, str) else mode['value']

operation_list = entity.attributes.get(climate.ATTR_OPERATION_LIST)
ha_mode = next(
(k for k, v in API_THERMOSTAT_MODES.items() if v == mode),
None
)
if ha_mode not in operation_list:
msg = 'The requested thermostat mode {} is not supported'.format(mode)
raise AlexaUnsupportedThermostatModeError(msg)

data = {
ATTR_ENTITY_ID: entity.entity_id,
climate.ATTR_OPERATION_MODE: ha_mode,
}

ha_preset = next(
(k for k, v in API_THERMOSTAT_PRESETS.items() if v == mode),
None
)

if ha_preset:
presets = entity.attributes.get(climate.ATTR_PRESET_MODES, [])

if ha_preset not in presets:
msg = 'The requested thermostat mode {} is not supported'.format(
ha_preset
)
raise AlexaUnsupportedThermostatModeError(msg)

service = climate.SERVICE_SET_PRESET_MODE
data[climate.ATTR_PRESET_MODE] = climate.PRESET_ECO

else:
operation_list = entity.attributes.get(climate.ATTR_HVAC_MODES)
ha_mode = next(
(k for k, v in API_THERMOSTAT_MODES.items() if v == mode),
None
)
if ha_mode not in operation_list:
msg = 'The requested thermostat mode {} is not supported'.format(
mode
)
raise AlexaUnsupportedThermostatModeError(msg)

service = climate.SERVICE_SET_HVAC_MODE
data[climate.ATTR_HVAC_MODE] = ha_mode

response = directive.response()
await hass.services.async_call(
entity.domain, climate.SERVICE_SET_OPERATION_MODE, data,
climate.DOMAIN, service, data,
blocking=False, context=context)
response.add_context_property({
'name': 'thermostatMode',
@@ -7,11 +7,8 @@

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_ON_OFF, STATE_HEAT)
from homeassistant.const import ATTR_NAME
from homeassistant.const import (ATTR_TEMPERATURE,
STATE_OFF, TEMP_CELSIUS)
SUPPORT_TARGET_TEMPERATURE, HVAC_MODE_OFF, HVAC_MODE_HEAT)
from homeassistant.const import ATTR_NAME, ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import (ATTR_VALUE, CONF_CLIENT_ID, CONF_CLIENT_SECRET,
@@ -20,8 +17,7 @@

_LOGGER = logging.getLogger(__name__)

SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE |
SUPPORT_ON_OFF)
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE

SEND_COMFORT_FEEDBACK_SCHEMA = vol.Schema({
vol.Required(ATTR_NAME): cv.string,
@@ -177,11 +173,6 @@ def current_humidity(self):
"""Return the current humidity."""
return self._data.get('humidity')

@property
def is_on(self):
"""Return true if heater is on."""
return self._data.get('power', '').lower() == 'on'

@property
def min_temp(self):
"""Return the minimum temperature."""
@@ -198,9 +189,12 @@ def supported_features(self):
return SUPPORT_FLAGS

@property
def current_operation(self):
def hvac_mode(self):
"""Return current operation."""
return STATE_HEAT if self.is_on else STATE_OFF
if self._data.get('power', '').lower() == 'on':
return HVAC_MODE_HEAT

return HVAC_MODE_OFF

async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
@@ -209,13 +203,13 @@ def current_operation(self):
return
await self._heater.set_target_temperature(temperature)

async def async_turn_on(self):
"""Turn device on."""
await self._heater.turn_on()

async def async_turn_off(self):
"""Turn device off."""
await self._heater.turn_off()
async def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
if hvac_mode == HVAC_MODE_HEAT:
await self._heater.turn_on()
return
if hvac_mode == HVAC_MODE_OFF:
await self._heater.turn_off()

async def async_update(self):
"""Retrieve latest state."""
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.