2019-06-13 15:43:57 +00:00
|
|
|
"""Alexa capabilities."""
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from homeassistant.const import (
|
|
|
|
ATTR_SUPPORTED_FEATURES,
|
|
|
|
ATTR_TEMPERATURE,
|
|
|
|
ATTR_UNIT_OF_MEASUREMENT,
|
2019-10-04 15:41:47 +00:00
|
|
|
STATE_ALARM_ARMED_AWAY,
|
|
|
|
STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
|
|
|
STATE_ALARM_ARMED_HOME,
|
|
|
|
STATE_ALARM_ARMED_NIGHT,
|
2019-06-13 15:43:57 +00:00
|
|
|
STATE_LOCKED,
|
|
|
|
STATE_OFF,
|
|
|
|
STATE_ON,
|
|
|
|
STATE_UNAVAILABLE,
|
|
|
|
STATE_UNLOCKED,
|
2019-08-31 14:46:26 +00:00
|
|
|
STATE_UNKNOWN,
|
2019-06-13 15:43:57 +00:00
|
|
|
)
|
|
|
|
import homeassistant.components.climate.const as climate
|
2019-10-04 15:41:47 +00:00
|
|
|
from homeassistant.components.alarm_control_panel import ATTR_CODE_FORMAT, FORMAT_NUMBER
|
2019-07-31 19:25:30 +00:00
|
|
|
from homeassistant.components import light, fan, cover
|
2019-06-13 15:43:57 +00:00
|
|
|
import homeassistant.util.color as color_util
|
2019-09-19 16:19:27 +00:00
|
|
|
import homeassistant.util.dt as dt_util
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
from .const import (
|
2019-10-23 05:01:03 +00:00
|
|
|
Catalog,
|
2019-06-13 15:43:57 +00:00
|
|
|
API_TEMP_UNITS,
|
|
|
|
API_THERMOSTAT_MODES,
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
API_THERMOSTAT_PRESETS,
|
2019-06-13 15:43:57 +00:00
|
|
|
DATE_FORMAT,
|
|
|
|
PERCENTAGE_FAN_MAP,
|
2019-10-23 05:01:03 +00:00
|
|
|
RANGE_FAN_MAP,
|
2019-06-13 15:43:57 +00:00
|
|
|
)
|
|
|
|
from .errors import UnsupportedProperty
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaCapability:
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Base class for Alexa capability interfaces.
|
|
|
|
|
|
|
|
The Smart Home Skills API defines a number of "capability interfaces",
|
|
|
|
roughly analogous to domains in Home Assistant. The supported interfaces
|
|
|
|
describe what actions can be performed on a particular device.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/message-guide.html
|
|
|
|
"""
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
def __init__(self, entity, instance=None):
|
|
|
|
"""Initialize an Alexa capability."""
|
2019-06-13 15:43:57 +00:00
|
|
|
self.entity = entity
|
2019-10-23 05:01:03 +00:00
|
|
|
self.instance = instance
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def properties_supported():
|
|
|
|
"""Return what properties this entity supports."""
|
|
|
|
return []
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def properties_proactively_reported():
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return False
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def properties_retrievable():
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return False
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
@staticmethod
|
|
|
|
def properties_non_controllable():
|
|
|
|
"""Return True if non controllable."""
|
|
|
|
return None
|
|
|
|
|
2019-06-13 15:43:57 +00:00
|
|
|
@staticmethod
|
|
|
|
def get_property(name):
|
|
|
|
"""Read and return a property.
|
|
|
|
|
|
|
|
Return value should be a dict, or raise UnsupportedProperty.
|
|
|
|
|
|
|
|
Properties can also have a timeOfSample and uncertaintyInMilliseconds,
|
|
|
|
but returning those metadata is not yet implemented.
|
|
|
|
"""
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def supports_deactivation():
|
|
|
|
"""Applicable only to scenes."""
|
|
|
|
return None
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
@staticmethod
|
|
|
|
def capability_resources():
|
|
|
|
"""Applicable to ToggleController, RangeController, and ModeController interfaces."""
|
|
|
|
return []
|
|
|
|
|
2019-10-04 15:41:47 +00:00
|
|
|
@staticmethod
|
|
|
|
def configuration():
|
2019-10-23 05:01:03 +00:00
|
|
|
"""Return the Configuration object."""
|
2019-10-04 15:41:47 +00:00
|
|
|
return []
|
|
|
|
|
2019-06-13 15:43:57 +00:00
|
|
|
def serialize_discovery(self):
|
|
|
|
"""Serialize according to the Discovery API."""
|
|
|
|
result = {
|
2019-07-31 19:25:30 +00:00
|
|
|
"type": "AlexaInterface",
|
|
|
|
"interface": self.name(),
|
|
|
|
"version": "3",
|
|
|
|
"properties": {
|
|
|
|
"supported": self.properties_supported(),
|
|
|
|
"proactivelyReported": self.properties_proactively_reported(),
|
|
|
|
"retrievable": self.properties_retrievable(),
|
2019-06-13 15:43:57 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
# pylint: disable=assignment-from-none
|
|
|
|
non_controllable = self.properties_non_controllable()
|
|
|
|
if non_controllable is not None:
|
|
|
|
result["properties"]["nonControllable"] = non_controllable
|
|
|
|
|
2019-06-13 15:43:57 +00:00
|
|
|
# pylint: disable=assignment-from-none
|
|
|
|
supports_deactivation = self.supports_deactivation()
|
|
|
|
if supports_deactivation is not None:
|
2019-07-31 19:25:30 +00:00
|
|
|
result["supportsDeactivation"] = supports_deactivation
|
2019-10-04 15:41:47 +00:00
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
capability_resources = self.serialize_capability_resources()
|
|
|
|
if capability_resources:
|
|
|
|
result["capabilityResources"] = capability_resources
|
|
|
|
|
2019-10-04 15:41:47 +00:00
|
|
|
configuration = self.configuration()
|
|
|
|
if configuration:
|
|
|
|
result["configuration"] = configuration
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
# pylint: disable=assignment-from-none
|
|
|
|
instance = self.instance
|
|
|
|
if instance is not None:
|
|
|
|
result["instance"] = instance
|
|
|
|
|
2019-06-13 15:43:57 +00:00
|
|
|
return result
|
|
|
|
|
|
|
|
def serialize_properties(self):
|
|
|
|
"""Return properties serialized for an API response."""
|
|
|
|
for prop in self.properties_supported():
|
2019-07-31 19:25:30 +00:00
|
|
|
prop_name = prop["name"]
|
2019-06-13 15:43:57 +00:00
|
|
|
# pylint: disable=assignment-from-no-return
|
|
|
|
prop_value = self.get_property(prop_name)
|
|
|
|
if prop_value is not None:
|
2019-10-23 05:01:03 +00:00
|
|
|
result = {
|
2019-07-31 19:25:30 +00:00
|
|
|
"name": prop_name,
|
|
|
|
"namespace": self.name(),
|
|
|
|
"value": prop_value,
|
2019-09-19 16:19:27 +00:00
|
|
|
"timeOfSample": dt_util.utcnow().strftime(DATE_FORMAT),
|
2019-07-31 19:25:30 +00:00
|
|
|
"uncertaintyInMilliseconds": 0,
|
2019-06-13 15:43:57 +00:00
|
|
|
}
|
2019-10-23 05:01:03 +00:00
|
|
|
instance = self.instance
|
|
|
|
if instance is not None:
|
|
|
|
result["instance"] = instance
|
2019-06-13 15:43:57 +00:00
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
yield result
|
|
|
|
|
|
|
|
def serialize_capability_resources(self):
|
|
|
|
"""Return capabilityResources friendlyNames serialized for an API response."""
|
|
|
|
resources = self.capability_resources()
|
|
|
|
if resources:
|
|
|
|
return {"friendlyNames": self.serialize_friendly_names(resources)}
|
|
|
|
|
|
|
|
return None
|
2019-06-13 15:43:57 +00:00
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
@staticmethod
|
|
|
|
def serialize_friendly_names(resources):
|
|
|
|
"""Return capabilityResources, ModeResources, or presetResources friendlyNames serialized for an API response."""
|
|
|
|
friendly_names = []
|
|
|
|
for resource in resources:
|
|
|
|
if resource["type"] == Catalog.LABEL_ASSET:
|
|
|
|
friendly_names.append(
|
|
|
|
{
|
|
|
|
"@type": Catalog.LABEL_ASSET,
|
|
|
|
"value": {"assetId": resource["value"]},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
friendly_names.append(
|
|
|
|
{
|
|
|
|
"@type": Catalog.LABEL_TEXT,
|
|
|
|
"value": {"text": resource["value"], "locale": "en-US"},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
return friendly_names
|
|
|
|
|
|
|
|
|
|
|
|
class AlexaEndpointHealth(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.EndpointHealth.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/smarthome/state-reporting-for-a-smart-home-skill.html#report-state-when-alexa-requests-it
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, hass, entity):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.hass = hass
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.EndpointHealth"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "connectivity"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return False
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "connectivity":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.entity.state == STATE_UNAVAILABLE:
|
2019-07-31 19:25:30 +00:00
|
|
|
return {"value": "UNREACHABLE"}
|
|
|
|
return {"value": "OK"}
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaPowerController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.PowerController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-powercontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.PowerController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "powerState"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "powerState":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
if self.entity.domain == climate.DOMAIN:
|
|
|
|
is_on = self.entity.state != climate.HVAC_MODE_OFF
|
|
|
|
|
|
|
|
else:
|
|
|
|
is_on = self.entity.state != STATE_OFF
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
return "ON" if is_on else "OFF"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaLockController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.LockController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-lockcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.LockController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "lockState"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "lockState":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.entity.state == STATE_LOCKED:
|
2019-07-31 19:25:30 +00:00
|
|
|
return "LOCKED"
|
2019-06-13 15:43:57 +00:00
|
|
|
if self.entity.state == STATE_UNLOCKED:
|
2019-07-31 19:25:30 +00:00
|
|
|
return "UNLOCKED"
|
|
|
|
return "JAMMED"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaSceneController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.SceneController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-scenecontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, entity, supports_deactivation):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.supports_deactivation = lambda: supports_deactivation
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.SceneController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaBrightnessController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.BrightnessController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-brightnesscontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.BrightnessController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "brightness"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "brightness":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
2019-07-31 19:25:30 +00:00
|
|
|
if "brightness" in self.entity.attributes:
|
|
|
|
return round(self.entity.attributes["brightness"] / 255.0 * 100)
|
2019-06-13 15:43:57 +00:00
|
|
|
return 0
|
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaColorController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.ColorController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-colorcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.ColorController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "color"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "color":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
hue, saturation = self.entity.attributes.get(light.ATTR_HS_COLOR, (0, 0))
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
return {
|
2019-07-31 19:25:30 +00:00
|
|
|
"hue": hue,
|
|
|
|
"saturation": saturation / 100.0,
|
|
|
|
"brightness": self.entity.attributes.get(light.ATTR_BRIGHTNESS, 0) / 255.0,
|
2019-06-13 15:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaColorTemperatureController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.ColorTemperatureController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-colortemperaturecontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.ColorTemperatureController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "colorTemperatureInKelvin"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "colorTemperatureInKelvin":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
2019-07-31 19:25:30 +00:00
|
|
|
if "color_temp" in self.entity.attributes:
|
2019-06-13 15:43:57 +00:00
|
|
|
return color_util.color_temperature_mired_to_kelvin(
|
2019-07-31 19:25:30 +00:00
|
|
|
self.entity.attributes["color_temp"]
|
|
|
|
)
|
2019-10-02 22:59:21 +00:00
|
|
|
return None
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaPercentageController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.PercentageController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-percentagecontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.PercentageController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "percentage"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "percentage":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.entity.domain == fan.DOMAIN:
|
|
|
|
speed = self.entity.attributes.get(fan.ATTR_SPEED)
|
|
|
|
|
|
|
|
return PERCENTAGE_FAN_MAP.get(speed, 0)
|
|
|
|
|
|
|
|
if self.entity.domain == cover.DOMAIN:
|
|
|
|
return self.entity.attributes.get(cover.ATTR_CURRENT_POSITION, 0)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaSpeaker(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.Speaker.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-speaker.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.Speaker"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaStepSpeaker(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.StepSpeaker.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-stepspeaker.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.StepSpeaker"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaPlaybackController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.PlaybackController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-playbackcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.PlaybackController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaInputController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.InputController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-inputcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.InputController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaTemperatureSensor(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.TemperatureSensor.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-temperaturesensor.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, hass, entity):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.hass = hass
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.TemperatureSensor"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "temperature"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "temperature":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
unit = self.entity.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
|
|
|
temp = self.entity.state
|
|
|
|
if self.entity.domain == climate.DOMAIN:
|
|
|
|
unit = self.hass.config.units.temperature_unit
|
2019-07-31 19:25:30 +00:00
|
|
|
temp = self.entity.attributes.get(climate.ATTR_CURRENT_TEMPERATURE)
|
2019-08-31 14:46:26 +00:00
|
|
|
|
2019-10-02 22:53:04 +00:00
|
|
|
if temp in (STATE_UNAVAILABLE, STATE_UNKNOWN, None):
|
2019-08-31 14:46:26 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
try:
|
|
|
|
temp = float(temp)
|
|
|
|
except ValueError:
|
|
|
|
_LOGGER.warning("Invalid temp value %s for %s", temp, self.entity.entity_id)
|
|
|
|
return None
|
|
|
|
|
|
|
|
return {"value": temp, "scale": API_TEMP_UNITS[unit]}
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaContactSensor(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.ContactSensor.
|
|
|
|
|
|
|
|
The Alexa.ContactSensor interface describes the properties and events used
|
|
|
|
to report the state of an endpoint that detects contact between two
|
|
|
|
surfaces. For example, a contact sensor can report whether a door or window
|
|
|
|
is open.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-contactsensor.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, hass, entity):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.hass = hass
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.ContactSensor"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "detectionState"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "detectionState":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.entity.state == STATE_ON:
|
2019-07-31 19:25:30 +00:00
|
|
|
return "DETECTED"
|
|
|
|
return "NOT_DETECTED"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaMotionSensor(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.MotionSensor.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-motionsensor.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, hass, entity):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.hass = hass
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.MotionSensor"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return [{"name": "detectionState"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-07-31 19:25:30 +00:00
|
|
|
if name != "detectionState":
|
2019-06-13 15:43:57 +00:00
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.entity.state == STATE_ON:
|
2019-07-31 19:25:30 +00:00
|
|
|
return "DETECTED"
|
|
|
|
return "NOT_DETECTED"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaThermostatController(AlexaCapability):
|
2019-06-13 15:43:57 +00:00
|
|
|
"""Implements Alexa.ThermostatController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-thermostatcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, hass, entity):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.hass = hass
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return "Alexa.ThermostatController"
|
2019-06-13 15:43:57 +00:00
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
2019-07-31 19:25:30 +00:00
|
|
|
properties = [{"name": "thermostatMode"}]
|
2019-06-13 15:43:57 +00:00
|
|
|
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
|
|
|
|
if supported & climate.SUPPORT_TARGET_TEMPERATURE:
|
2019-07-31 19:25:30 +00:00
|
|
|
properties.append({"name": "targetSetpoint"})
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
if supported & climate.SUPPORT_TARGET_TEMPERATURE_RANGE:
|
2019-07-31 19:25:30 +00:00
|
|
|
properties.append({"name": "lowerSetpoint"})
|
|
|
|
properties.append({"name": "upperSetpoint"})
|
2019-06-13 15:43:57 +00:00
|
|
|
return properties
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
2019-10-02 22:53:04 +00:00
|
|
|
if self.entity.state == STATE_UNAVAILABLE:
|
|
|
|
return None
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
if name == "thermostatMode":
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
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'",
|
2019-07-31 19:25:30 +00:00
|
|
|
self.entity.entity_id,
|
|
|
|
type(self.entity),
|
|
|
|
self.entity.state,
|
|
|
|
)
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
raise UnsupportedProperty(name)
|
2019-06-13 15:43:57 +00:00
|
|
|
return mode
|
|
|
|
|
|
|
|
unit = self.hass.config.units.temperature_unit
|
2019-07-31 19:25:30 +00:00
|
|
|
if name == "targetSetpoint":
|
2019-06-13 15:43:57 +00:00
|
|
|
temp = self.entity.attributes.get(ATTR_TEMPERATURE)
|
2019-07-31 19:25:30 +00:00
|
|
|
elif name == "lowerSetpoint":
|
2019-06-13 15:43:57 +00:00
|
|
|
temp = self.entity.attributes.get(climate.ATTR_TARGET_TEMP_LOW)
|
2019-07-31 19:25:30 +00:00
|
|
|
elif name == "upperSetpoint":
|
2019-06-13 15:43:57 +00:00
|
|
|
temp = self.entity.attributes.get(climate.ATTR_TARGET_TEMP_HIGH)
|
|
|
|
else:
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if temp is None:
|
|
|
|
return None
|
|
|
|
|
2019-08-31 14:46:26 +00:00
|
|
|
try:
|
|
|
|
temp = float(temp)
|
|
|
|
except ValueError:
|
|
|
|
_LOGGER.warning(
|
|
|
|
"Invalid temp value %s for %s in %s", temp, name, self.entity.entity_id
|
|
|
|
)
|
|
|
|
return None
|
|
|
|
|
|
|
|
return {"value": temp, "scale": API_TEMP_UNITS[unit]}
|
2019-10-03 20:28:02 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaPowerLevelController(AlexaCapability):
|
2019-10-03 20:28:02 +00:00
|
|
|
"""Implements Alexa.PowerLevelController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-powerlevelcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
|
|
|
return "Alexa.PowerLevelController"
|
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
|
|
|
return [{"name": "powerLevel"}]
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
|
|
|
if name != "powerLevel":
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.entity.domain == fan.DOMAIN:
|
|
|
|
speed = self.entity.attributes.get(fan.ATTR_SPEED)
|
|
|
|
|
|
|
|
return PERCENTAGE_FAN_MAP.get(speed, None)
|
|
|
|
|
|
|
|
return None
|
2019-10-04 15:41:47 +00:00
|
|
|
|
|
|
|
|
2019-10-23 05:01:03 +00:00
|
|
|
class AlexaSecurityPanelController(AlexaCapability):
|
2019-10-04 15:41:47 +00:00
|
|
|
"""Implements Alexa.SecurityPanelController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-securitypanelcontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, hass, entity):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity)
|
|
|
|
self.hass = hass
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
|
|
|
return "Alexa.SecurityPanelController"
|
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
|
|
|
return [{"name": "armState"}]
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
|
|
|
if name != "armState":
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
arm_state = self.entity.state
|
|
|
|
if arm_state == STATE_ALARM_ARMED_HOME:
|
|
|
|
return "ARMED_STAY"
|
|
|
|
if arm_state == STATE_ALARM_ARMED_AWAY:
|
|
|
|
return "ARMED_AWAY"
|
|
|
|
if arm_state == STATE_ALARM_ARMED_NIGHT:
|
|
|
|
return "ARMED_NIGHT"
|
|
|
|
if arm_state == STATE_ALARM_ARMED_CUSTOM_BYPASS:
|
|
|
|
return "ARMED_STAY"
|
|
|
|
return "DISARMED"
|
|
|
|
|
|
|
|
def configuration(self):
|
2019-10-23 05:01:03 +00:00
|
|
|
"""Return configuration object with supported authorization types."""
|
2019-10-04 15:41:47 +00:00
|
|
|
code_format = self.entity.attributes.get(ATTR_CODE_FORMAT)
|
|
|
|
|
|
|
|
if code_format == FORMAT_NUMBER:
|
|
|
|
return {"supportedAuthorizationTypes": [{"type": "FOUR_DIGIT_PIN"}]}
|
2019-10-23 05:01:03 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
class AlexaModeController(AlexaCapability):
|
|
|
|
"""Implements Alexa.ModeController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-modecontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, entity, instance, non_controllable=False):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity, instance)
|
|
|
|
self.properties_non_controllable = lambda: non_controllable
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
|
|
|
return "Alexa.ModeController"
|
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
|
|
|
return [{"name": "mode"}]
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
|
|
|
if name != "mode":
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_DIRECTION}":
|
|
|
|
return self.entity.attributes.get(fan.ATTR_DIRECTION)
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
def configuration(self):
|
|
|
|
"""Return configuration with modeResources."""
|
|
|
|
return self.serialize_mode_resources()
|
|
|
|
|
|
|
|
def capability_resources(self):
|
|
|
|
"""Return capabilityResources object."""
|
|
|
|
capability_resources = []
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_DIRECTION}":
|
|
|
|
capability_resources = [
|
|
|
|
{"type": Catalog.LABEL_ASSET, "value": Catalog.SETTING_DIRECTION}
|
|
|
|
]
|
|
|
|
|
|
|
|
return capability_resources
|
|
|
|
|
|
|
|
def mode_resources(self):
|
|
|
|
"""Return modeResources object."""
|
|
|
|
mode_resources = None
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_DIRECTION}":
|
|
|
|
mode_resources = {
|
|
|
|
"ordered": False,
|
|
|
|
"resources": [
|
|
|
|
{
|
|
|
|
"value": f"{fan.ATTR_DIRECTION}.{fan.DIRECTION_FORWARD}",
|
|
|
|
"friendly_names": [
|
|
|
|
{"type": Catalog.LABEL_TEXT, "value": fan.DIRECTION_FORWARD}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value": f"{fan.ATTR_DIRECTION}.{fan.DIRECTION_REVERSE}",
|
|
|
|
"friendly_names": [
|
|
|
|
{"type": Catalog.LABEL_TEXT, "value": fan.DIRECTION_REVERSE}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
return mode_resources
|
|
|
|
|
|
|
|
def serialize_mode_resources(self):
|
|
|
|
"""Return ModeResources, friendlyNames serialized for an API response."""
|
|
|
|
mode_resources = []
|
|
|
|
resources = self.mode_resources()
|
|
|
|
ordered = resources["ordered"]
|
|
|
|
for resource in resources["resources"]:
|
|
|
|
mode_value = resource["value"]
|
|
|
|
friendly_names = resource["friendly_names"]
|
|
|
|
result = {
|
|
|
|
"value": mode_value,
|
|
|
|
"modeResources": {
|
|
|
|
"friendlyNames": self.serialize_friendly_names(friendly_names)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
mode_resources.append(result)
|
|
|
|
|
|
|
|
return {"ordered": ordered, "supportedModes": mode_resources}
|
|
|
|
|
|
|
|
|
|
|
|
class AlexaRangeController(AlexaCapability):
|
|
|
|
"""Implements Alexa.RangeController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-rangecontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, entity, instance, non_controllable=False):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity, instance)
|
|
|
|
self.properties_non_controllable = lambda: non_controllable
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
|
|
|
return "Alexa.RangeController"
|
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
|
|
|
return [{"name": "rangeValue"}]
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
|
|
|
if name != "rangeValue":
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_SPEED}":
|
|
|
|
speed = self.entity.attributes.get(fan.ATTR_SPEED)
|
|
|
|
return RANGE_FAN_MAP.get(speed, 0)
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
def configuration(self):
|
|
|
|
"""Return configuration with presetResources."""
|
|
|
|
return self.serialize_preset_resources()
|
|
|
|
|
|
|
|
def capability_resources(self):
|
|
|
|
"""Return capabilityResources object."""
|
|
|
|
capability_resources = []
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_SPEED}":
|
|
|
|
return [{"type": Catalog.LABEL_ASSET, "value": Catalog.SETTING_FANSPEED}]
|
|
|
|
|
|
|
|
return capability_resources
|
|
|
|
|
|
|
|
def preset_resources(self):
|
|
|
|
"""Return presetResources object."""
|
|
|
|
preset_resources = []
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_SPEED}":
|
|
|
|
preset_resources = {
|
|
|
|
"minimumValue": 1,
|
|
|
|
"maximumValue": 3,
|
|
|
|
"precision": 1,
|
|
|
|
"presets": [
|
|
|
|
{
|
|
|
|
"rangeValue": 1,
|
|
|
|
"names": [
|
|
|
|
{
|
|
|
|
"type": Catalog.LABEL_ASSET,
|
|
|
|
"value": Catalog.VALUE_MINIMUM,
|
|
|
|
},
|
|
|
|
{"type": Catalog.LABEL_ASSET, "value": Catalog.VALUE_LOW},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"rangeValue": 2,
|
|
|
|
"names": [
|
|
|
|
{"type": Catalog.LABEL_ASSET, "value": Catalog.VALUE_MEDIUM}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"rangeValue": 3,
|
|
|
|
"names": [
|
|
|
|
{
|
|
|
|
"type": Catalog.LABEL_ASSET,
|
|
|
|
"value": Catalog.VALUE_MAXIMUM,
|
|
|
|
},
|
|
|
|
{"type": Catalog.LABEL_ASSET, "value": Catalog.VALUE_HIGH},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
return preset_resources
|
|
|
|
|
|
|
|
def serialize_preset_resources(self):
|
|
|
|
"""Return PresetResources, friendlyNames serialized for an API response."""
|
|
|
|
preset_resources = []
|
|
|
|
resources = self.preset_resources()
|
|
|
|
for preset in resources["presets"]:
|
|
|
|
preset_resources.append(
|
|
|
|
{
|
|
|
|
"rangeValue": preset["rangeValue"],
|
|
|
|
"presetResources": {
|
|
|
|
"friendlyNames": self.serialize_friendly_names(preset["names"])
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
return {
|
|
|
|
"supportedRange": {
|
|
|
|
"minimumValue": resources["minimumValue"],
|
|
|
|
"maximumValue": resources["maximumValue"],
|
|
|
|
"precision": resources["precision"],
|
|
|
|
},
|
|
|
|
"presets": preset_resources,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class AlexaToggleController(AlexaCapability):
|
|
|
|
"""Implements Alexa.ToggleController.
|
|
|
|
|
|
|
|
https://developer.amazon.com/docs/device-apis/alexa-togglecontroller.html
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, entity, instance, non_controllable=False):
|
|
|
|
"""Initialize the entity."""
|
|
|
|
super().__init__(entity, instance)
|
|
|
|
self.properties_non_controllable = lambda: non_controllable
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
"""Return the Alexa API name of this interface."""
|
|
|
|
return "Alexa.ToggleController"
|
|
|
|
|
|
|
|
def properties_supported(self):
|
|
|
|
"""Return what properties this entity supports."""
|
|
|
|
return [{"name": "toggleState"}]
|
|
|
|
|
|
|
|
def properties_proactively_reported(self):
|
|
|
|
"""Return True if properties asynchronously reported."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def properties_retrievable(self):
|
|
|
|
"""Return True if properties can be retrieved."""
|
|
|
|
return True
|
|
|
|
|
|
|
|
def get_property(self, name):
|
|
|
|
"""Read and return a property."""
|
|
|
|
if name != "toggleState":
|
|
|
|
raise UnsupportedProperty(name)
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_OSCILLATING}":
|
|
|
|
is_on = bool(self.entity.attributes.get(fan.ATTR_OSCILLATING))
|
|
|
|
return "ON" if is_on else "OFF"
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
def capability_resources(self):
|
|
|
|
"""Return capabilityResources object."""
|
|
|
|
capability_resources = []
|
|
|
|
|
|
|
|
if self.instance == f"{fan.DOMAIN}.{fan.ATTR_OSCILLATING}":
|
|
|
|
capability_resources = [
|
|
|
|
{"type": Catalog.LABEL_ASSET, "value": Catalog.SETTING_OSCILLATE},
|
|
|
|
{"type": Catalog.LABEL_TEXT, "value": "Rotate"},
|
|
|
|
{"type": Catalog.LABEL_TEXT, "value": "Rotation"},
|
|
|
|
]
|
|
|
|
|
|
|
|
return capability_resources
|