mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
got the basics working
This commit is contained in:
parent
f376061e23
commit
863955e1bd
@ -14,7 +14,7 @@ from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS)
|
|||||||
|
|
||||||
REQUIREMENTS = ['evohomeclient']
|
REQUIREMENTS = ['evohomeclient']
|
||||||
|
|
||||||
from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE
|
# from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
@ -30,7 +30,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from evohomeclient import EvohomeClient
|
from evohomeclient2 import EvohomeClient
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
"Error while importing dependency nest. "
|
"Error while importing dependency nest. "
|
||||||
@ -55,6 +55,9 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
#self.structure = structure
|
#self.structure = structure
|
||||||
self.device = device
|
self.device = device
|
||||||
|
self._current_temperature=None
|
||||||
|
self._target_temperature=None
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -71,19 +74,21 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
""" Returns device specific state attributes. """
|
""" Returns device specific state attributes. """
|
||||||
# Move these to Thermostat Device and make them global
|
# Move these to Thermostat Device and make them global
|
||||||
data = self.device.temperatures(force_refresh=True)[0]
|
return {}
|
||||||
return {
|
|
||||||
ATTR_CURRENT_TEMPERATURE: data['temp'],
|
|
||||||
ATTR_TEMPERATURE: data['setpoint']
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# @property
|
|
||||||
# def current_temperature(self):
|
@property
|
||||||
# """ Returns the current temperature. """
|
def current_temperature(self):
|
||||||
|
""" Returns the current temperature. """
|
||||||
|
return self._current_temperature
|
||||||
#return round(self.device.temperature, 1)
|
#return round(self.device.temperature, 1)
|
||||||
|
|
||||||
|
@current_temperature.setter
|
||||||
|
def current_temparature(self,value):
|
||||||
|
self._current_temperature=value
|
||||||
|
|
||||||
# @property
|
# @property
|
||||||
# def operation(self):
|
# def operation(self):
|
||||||
# """ Returns current operation ie. heat, cool, idle """
|
# """ Returns current operation ie. heat, cool, idle """
|
||||||
@ -94,9 +99,15 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
# else:
|
# else:
|
||||||
# return STATE_IDLE
|
# return STATE_IDLE
|
||||||
|
|
||||||
# @property
|
@property
|
||||||
# def target_temperature(self):
|
def target_temperature(self):
|
||||||
# """ Returns the temperature we try to reach. """
|
""" Returns the temperature we try to reach. """
|
||||||
|
return self._target_temperature
|
||||||
|
|
||||||
|
@target_temperature.setter
|
||||||
|
def target_temperature(self,value):
|
||||||
|
self._target_temperature=value
|
||||||
|
|
||||||
# target = self.device.target
|
# target = self.device.target
|
||||||
#
|
#
|
||||||
# if self.device.mode == 'range':
|
# if self.device.mode == 'range':
|
||||||
@ -170,6 +181,12 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
# else:
|
# else:
|
||||||
# return temp
|
# return temp
|
||||||
|
|
||||||
|
@property
|
||||||
|
def should_poll(self):
|
||||||
|
""" No polling needed for a demo thermostat. """
|
||||||
|
return True
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" Python-nest has its own mechanism for staying up to date. """
|
for dev in self.device.temperatures():
|
||||||
pass
|
self._current_temperature=dev['temp']
|
||||||
|
self._target_temperature=dev['setpoint']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user