diff --git a/.coveragerc b/.coveragerc index ec03242880c2f98f5430f4396a6114e8b4f96793..ddbd4a1e0b17f6f430f3c4a8e692d55f4df71961 100644 --- a/.coveragerc +++ b/.coveragerc @@ -275,6 +275,7 @@ omit = homeassistant/components/camera/ring.py homeassistant/components/camera/synology.py homeassistant/components/camera/yi.py + homeassistant/components/climate/ephember.py homeassistant/components/climate/eq3btsmart.py homeassistant/components/climate/flexit.py homeassistant/components/climate/heatmiser.py diff --git a/CODEOWNERS b/CODEOWNERS index 0830adcc355421acdca094e27e5b632a9480c801..46e01c2b89fbca06a26f349017e38d1b92d7fda9 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -41,6 +41,7 @@ homeassistant/components/*/zwave.py @home-assistant/z-wave # Indiviudal components homeassistant/components/alarm_control_panel/egardia.py @jeroenterheerdt homeassistant/components/camera/yi.py @bachya +homeassistant/components/climate/ephember.py @ttroy50 homeassistant/components/climate/eq3btsmart.py @rytilahti homeassistant/components/climate/sensibo.py @andrey-git homeassistant/components/cover/template.py @PhracturedBlue @@ -58,7 +59,6 @@ homeassistant/components/sensor/waqi.py @andrey-git homeassistant/components/switch/rainmachine.py @bachya homeassistant/components/switch/tplink.py @rytilahti -homeassistant/components/*/axis.py @Kane610 homeassistant/components/*/broadlink.py @danielhiversen homeassistant/components/*/rfxtrx.py @danielhiversen homeassistant/components/tesla.py @zabuldon diff --git a/homeassistant/components/climate/ephember.py b/homeassistant/components/climate/ephember.py new file mode 100644 index 0000000000000000000000000000000000000000..79ff767c82bc5b25cb88884aba45e923ab041481 --- /dev/null +++ b/homeassistant/components/climate/ephember.py @@ -0,0 +1,117 @@ +""" +Support for the EPH Controls Ember themostats. + +For more details about this platform, please refer to the documentation at +https://home-assistant.io/components/climate.ephember/ +""" +import logging +from datetime import timedelta +import voluptuous as vol + +from homeassistant.components.climate import ( + ClimateDevice, PLATFORM_SCHEMA, STATE_HEAT, STATE_IDLE) +from homeassistant.const import ( + TEMP_CELSIUS, CONF_USERNAME, CONF_PASSWORD) +import homeassistant.helpers.config_validation as cv + +REQUIREMENTS = ['pyephember==0.1.1'] + +_LOGGER = logging.getLogger(__name__) + +# Return cached results if last scan was less then this time ago +SCAN_INTERVAL = timedelta(seconds=120) + +PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ + vol.Required(CONF_USERNAME): cv.string, + vol.Required(CONF_PASSWORD): cv.string +}) + + +def setup_platform(hass, config, add_devices, discovery_info=None): + """Set up the ephember thermostat.""" + from pyephember.pyephember import EphEmber + + username = config.get(CONF_USERNAME) + password = config.get(CONF_PASSWORD) + + try: + ember = EphEmber(username, password) + zones = ember.get_zones() + for zone in zones: + add_devices([EphEmberThermostat(ember, zone)]) + except RuntimeError: + _LOGGER.error("Cannot connect to EphEmber") + return + + return + + +class EphEmberThermostat(ClimateDevice): + """Representation of a HeatmiserV3 thermostat.""" + + def __init__(self, ember, zone): + """Initialize the thermostat.""" + self._ember = ember + self._zone_name = zone['name'] + self._zone = zone + self._hot_water = zone['isHotWater'] + + @property + def name(self): + """Return the name of the thermostat, if any.""" + return self._zone_name + + @property + def temperature_unit(self): + """Return the unit of measurement which this thermostat uses.""" + return TEMP_CELSIUS + + @property + def current_temperature(self): + """Return the current temperature.""" + return self._zone['currentTemperature'] + + @property + def target_temperature(self): + """Return the temperature we try to reach.""" + return self._zone['targetTemperature'] + + @property + def current_operation(self): + """Return current operation ie. heat, cool, idle.""" + if self._zone['isCurrentlyActive']: + return STATE_HEAT + else: + return STATE_IDLE + + @property + def is_aux_heat_on(self): + """Return true if aux heater.""" + return self._zone['isBoostActive'] + + def turn_aux_heat_on(self): + """Turn auxiliary heater on.""" + self._ember.activate_boost_by_name( + self._zone_name, self._zone['targetTemperature']) + + def turn_aux_heat_off(self): + """Turn auxiliary heater off.""" + self._ember.deactivate_boost_by_name(self._zone_name) + + def set_temperature(self, **kwargs): + """Set new target temperature.""" + return + + @property + def min_temp(self): + """Return the minimum temperature.""" + return self._zone['targetTemperature'] + + @property + def max_temp(self): + """Return the maximum temperature.""" + return self._zone['targetTemperature'] + + def update(self): + """Get the latest data.""" + self._zone = self._ember.get_zone(self._zone_name) diff --git a/requirements_all.txt b/requirements_all.txt index 7b522beda312cc08f137e30fc395e0060cfa7837..5a49ac5ef8973b5a03b688b1fcd1f8db31dbfe5b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -626,6 +626,9 @@ pyemby==1.4 # homeassistant.components.envisalink pyenvisalink==2.2 +# homeassistant.components.climate.ephember +pyephember==0.1.1 + # homeassistant.components.sensor.fido pyfido==1.0.1