add eph ember controls (#9721)

* add eph ember controls

* updates based on review

* remove unused import

* update to new version of pyephember

* added myself to codeowners as requested

* make codeowners alphabetical

* run fixed gen_requirements_all

* Update ephember.py
This commit is contained in:
Thom Troy 2017-10-23 14:52:39 +01:00 committed by Pascal Vizeli
parent 176c99f0cd
commit 0b850b555f
4 changed files with 122 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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