mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Merge pull request #887 from sdague/dev
Add support for Proliphix thermostat
This commit is contained in:
commit
40c75f0a51
@ -124,6 +124,7 @@ omit =
|
|||||||
homeassistant/components/thermostat/homematic.py
|
homeassistant/components/thermostat/homematic.py
|
||||||
homeassistant/components/thermostat/honeywell.py
|
homeassistant/components/thermostat/honeywell.py
|
||||||
homeassistant/components/thermostat/nest.py
|
homeassistant/components/thermostat/nest.py
|
||||||
|
homeassistant/components/thermostat/proliphix.py
|
||||||
homeassistant/components/thermostat/radiotherm.py
|
homeassistant/components/thermostat/radiotherm.py
|
||||||
|
|
||||||
|
|
||||||
|
88
homeassistant/components/thermostat/proliphix.py
Normal file
88
homeassistant/components/thermostat/proliphix.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
"""homeassistant.components.thermostat.proliphix
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The Proliphix NT10e Thermostat is an ethernet connected thermostat. It
|
||||||
|
has a local HTTP interface that is based on get/set of OID values. A
|
||||||
|
complete collection of the API is available in this API doc:
|
||||||
|
|
||||||
|
https://github.com/sdague/thermostat.rb/blob/master/docs/PDP_API_R1_11.pdf
|
||||||
|
"""
|
||||||
|
|
||||||
|
from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL,
|
||||||
|
STATE_IDLE, STATE_HEAT)
|
||||||
|
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD,
|
||||||
|
CONF_HOST, TEMP_FAHRENHEIT)
|
||||||
|
|
||||||
|
REQUIREMENTS = ['proliphix==0.1.0']
|
||||||
|
|
||||||
|
|
||||||
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
""" Sets up the proliphix thermostats. """
|
||||||
|
username = config.get(CONF_USERNAME)
|
||||||
|
password = config.get(CONF_PASSWORD)
|
||||||
|
host = config.get(CONF_HOST)
|
||||||
|
|
||||||
|
import proliphix
|
||||||
|
|
||||||
|
pdp = proliphix.PDP(host, username, password)
|
||||||
|
|
||||||
|
add_devices([
|
||||||
|
ProliphixThermostat(pdp)
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
class ProliphixThermostat(ThermostatDevice):
|
||||||
|
""" Represents a Proliphix thermostat. """
|
||||||
|
|
||||||
|
def __init__(self, pdp):
|
||||||
|
self._pdp = pdp
|
||||||
|
# initial data
|
||||||
|
self._pdp.update()
|
||||||
|
self._name = self._pdp.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def should_poll(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
self._pdp.update()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
""" Returns the name. """
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_state_attributes(self):
|
||||||
|
return {
|
||||||
|
"fan": self._pdp.fan_state
|
||||||
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unit_of_measurement(self):
|
||||||
|
""" Returns the unit of measurement. """
|
||||||
|
return TEMP_FAHRENHEIT
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_temperature(self):
|
||||||
|
""" Returns the current temperature. """
|
||||||
|
return self._pdp.cur_temp
|
||||||
|
|
||||||
|
@property
|
||||||
|
def target_temperature(self):
|
||||||
|
""" Returns the temperature we try to reach. """
|
||||||
|
return self._pdp.setback_heat
|
||||||
|
|
||||||
|
@property
|
||||||
|
def operation(self):
|
||||||
|
state = self._pdp.hvac_state
|
||||||
|
if state in (1, 2):
|
||||||
|
return STATE_IDLE
|
||||||
|
elif state == 3:
|
||||||
|
return STATE_HEAT
|
||||||
|
elif state == 6:
|
||||||
|
return STATE_COOL
|
||||||
|
|
||||||
|
def set_temperature(self, temperature):
|
||||||
|
""" Set new target temperature. """
|
||||||
|
self._pdp.setback_heat = temperature
|
@ -196,6 +196,9 @@ evohomeclient==0.2.4
|
|||||||
# homeassistant.components.thermostat.nest
|
# homeassistant.components.thermostat.nest
|
||||||
python-nest==2.6.0
|
python-nest==2.6.0
|
||||||
|
|
||||||
|
# homeassistant.components.thermostat.proliphix
|
||||||
|
proliphix==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.thermostat.radiotherm
|
# homeassistant.components.thermostat.radiotherm
|
||||||
radiotherm==1.2
|
radiotherm==1.2
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user