Link Generic Thermostat helper entity to actuator entity device (#120767)
This commit is contained in:
parent
b03c10647e
commit
8ed11d4b90
4 changed files with 165 additions and 4 deletions
|
@ -54,6 +54,7 @@ from homeassistant.core import (
|
|||
)
|
||||
from homeassistant.exceptions import ConditionError
|
||||
from homeassistant.helpers import condition, config_validation as cv
|
||||
from homeassistant.helpers.device import async_device_info_to_link_from_entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import (
|
||||
async_track_state_change_event,
|
||||
|
@ -63,14 +64,12 @@ from homeassistant.helpers.reload import async_setup_reload_service
|
|||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, VolDictType
|
||||
|
||||
from . import DOMAIN, PLATFORMS
|
||||
from . import CONF_HEATER, DOMAIN, PLATFORMS
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_TOLERANCE = 0.3
|
||||
DEFAULT_NAME = "Generic Thermostat"
|
||||
|
||||
CONF_HEATER = "heater"
|
||||
CONF_SENSOR = "target_sensor"
|
||||
CONF_MIN_TEMP = "min_temp"
|
||||
CONF_MAX_TEMP = "max_temp"
|
||||
|
@ -190,6 +189,7 @@ async def _async_setup_config(
|
|||
async_add_entities(
|
||||
[
|
||||
GenericThermostat(
|
||||
hass,
|
||||
name,
|
||||
heater_entity_id,
|
||||
sensor_entity_id,
|
||||
|
@ -220,6 +220,7 @@ class GenericThermostat(ClimateEntity, RestoreEntity):
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
name: str,
|
||||
heater_entity_id: str,
|
||||
sensor_entity_id: str,
|
||||
|
@ -242,6 +243,10 @@ class GenericThermostat(ClimateEntity, RestoreEntity):
|
|||
self._attr_name = name
|
||||
self.heater_entity_id = heater_entity_id
|
||||
self.sensor_entity_id = sensor_entity_id
|
||||
self._attr_device_info = async_device_info_to_link_from_entity(
|
||||
hass,
|
||||
heater_entity_id,
|
||||
)
|
||||
self.ac_mode = ac_mode
|
||||
self.min_cycle_duration = min_cycle_duration
|
||||
self._cold_tolerance = cold_tolerance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue