Add base entity class in vicare integration (#101870)
* add entity base class * depend on base class * add device info to base class * remove individual DeviceInfo * move class * fix imports * add file comment * use super() * fix formatting * add vicare/entity.py
This commit is contained in:
parent
3e4edc8edd
commit
6e1c23906c
7 changed files with 36 additions and 50 deletions
|
@ -33,10 +33,10 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import DOMAIN, VICARE_API, VICARE_DEVICE_CONFIG, VICARE_NAME
|
||||
from .entity import ViCareEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -134,7 +134,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class ViCareClimate(ClimateEntity):
|
||||
class ViCareClimate(ViCareEntity, ClimateEntity):
|
||||
"""Representation of the ViCare heating climate device."""
|
||||
|
||||
_attr_precision = PRECISION_TENTHS
|
||||
|
@ -149,6 +149,7 @@ class ViCareClimate(ClimateEntity):
|
|||
|
||||
def __init__(self, name, api, circuit, device_config):
|
||||
"""Initialize the climate device."""
|
||||
super().__init__(device_config)
|
||||
self._attr_name = name
|
||||
self._api = api
|
||||
self._circuit = circuit
|
||||
|
@ -157,13 +158,6 @@ class ViCareClimate(ClimateEntity):
|
|||
self._current_program = None
|
||||
self._current_action = None
|
||||
self._attr_unique_id = f"{device_config.getConfig().serial}-{circuit.id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, device_config.getConfig().serial)},
|
||||
name=device_config.getModel(),
|
||||
manufacturer="Viessmann",
|
||||
model=device_config.getModel(),
|
||||
configuration_url="https://developer.viessmann.com/",
|
||||
)
|
||||
|
||||
def update(self) -> None:
|
||||
"""Let HA know there has been an update from the ViCare API."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue