mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Add hive trv support (#27033)
* TRV-Support * pyhive import update * Moved HVAC to new line * updated pyhiveapi version * Update for pylint errors * Fix Pylint Errors * Fixed Pylint 2 * removed whitespace * Black * Updates following review * updated phyhive to 0.2.19.3 * Corrected logic on TRV name * updated requirements as requested * Black run
This commit is contained in:
parent
2e17ad86af
commit
a9073451f8
@ -82,6 +82,7 @@ class HiveSession:
|
|||||||
switch = None
|
switch = None
|
||||||
weather = None
|
weather = None
|
||||||
attributes = None
|
attributes = None
|
||||||
|
trv = None
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
|
@ -8,6 +8,9 @@ from homeassistant.components.climate.const import (
|
|||||||
PRESET_NONE,
|
PRESET_NONE,
|
||||||
SUPPORT_PRESET_MODE,
|
SUPPORT_PRESET_MODE,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
|
CURRENT_HVAC_IDLE,
|
||||||
|
CURRENT_HVAC_OFF,
|
||||||
|
CURRENT_HVAC_HEAT,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||||
|
|
||||||
@ -26,6 +29,12 @@ HASS_TO_HIVE_STATE = {
|
|||||||
HVAC_MODE_OFF: "OFF",
|
HVAC_MODE_OFF: "OFF",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HIVE_TO_HASS_HVAC_ACTION = {
|
||||||
|
"UNKNOWN": CURRENT_HVAC_OFF,
|
||||||
|
False: CURRENT_HVAC_IDLE,
|
||||||
|
True: CURRENT_HVAC_HEAT,
|
||||||
|
}
|
||||||
|
|
||||||
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
||||||
SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]
|
SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]
|
||||||
SUPPORT_PRESET = [PRESET_NONE, PRESET_BOOST]
|
SUPPORT_PRESET = [PRESET_NONE, PRESET_BOOST]
|
||||||
@ -71,7 +80,11 @@ class HiveClimateEntity(HiveEntity, ClimateDevice):
|
|||||||
"""Return the name of the Climate device."""
|
"""Return the name of the Climate device."""
|
||||||
friendly_name = "Heating"
|
friendly_name = "Heating"
|
||||||
if self.node_name is not None:
|
if self.node_name is not None:
|
||||||
|
if self.device_type == "TRV":
|
||||||
|
friendly_name = self.node_name
|
||||||
|
else:
|
||||||
friendly_name = f"{self.node_name} {friendly_name}"
|
friendly_name = f"{self.node_name} {friendly_name}"
|
||||||
|
|
||||||
return friendly_name
|
return friendly_name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -95,6 +108,13 @@ class HiveClimateEntity(HiveEntity, ClimateDevice):
|
|||||||
"""
|
"""
|
||||||
return HIVE_TO_HASS_STATE[self.session.heating.get_mode(self.node_id)]
|
return HIVE_TO_HASS_STATE[self.session.heating.get_mode(self.node_id)]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hvac_action(self):
|
||||||
|
"""Return current HVAC action."""
|
||||||
|
return HIVE_TO_HASS_HVAC_ACTION[
|
||||||
|
self.session.heating.operational_status(self.node_id, self.device_type)
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temperature_unit(self):
|
def temperature_unit(self):
|
||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
@ -123,7 +143,10 @@ class HiveClimateEntity(HiveEntity, ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def preset_mode(self):
|
def preset_mode(self):
|
||||||
"""Return the current preset mode, e.g., home, away, temp."""
|
"""Return the current preset mode, e.g., home, away, temp."""
|
||||||
if self.session.heating.get_boost(self.node_id) == "ON":
|
if (
|
||||||
|
self.device_type == "Heating"
|
||||||
|
and self.session.heating.get_boost(self.node_id) == "ON"
|
||||||
|
):
|
||||||
return PRESET_BOOST
|
return PRESET_BOOST
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Hive",
|
"name": "Hive",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/hive",
|
"documentation": "https://www.home-assistant.io/integrations/hive",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyhiveapi==0.2.19.2"
|
"pyhiveapi==0.2.19.3"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -1229,7 +1229,7 @@ pyheos==0.6.0
|
|||||||
pyhik==0.2.3
|
pyhik==0.2.3
|
||||||
|
|
||||||
# homeassistant.components.hive
|
# homeassistant.components.hive
|
||||||
pyhiveapi==0.2.19.2
|
pyhiveapi==0.2.19.3
|
||||||
|
|
||||||
# homeassistant.components.homematic
|
# homeassistant.components.homematic
|
||||||
pyhomematic==0.1.60
|
pyhomematic==0.1.60
|
||||||
|
Loading…
x
Reference in New Issue
Block a user