hass-core/homeassistant/components/technove/entity.py
Christophe Gagnier 44f2b8e6a3
Implement TechnoVE integration ()
* Implement TechnoVE integration

Only the basic sensors for now.

* Add technoVE to strict typing

* Implement TechnoVE PR suggestions

* Remove Diagnostic from TechnoVE initial PR

* Switch status sensor to Enum device class

* Revert zeroconf for adding it back in subsequent PR

* Implement changes from feedback in TechnoVE PR

* Update homeassistant/components/technove/models.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update homeassistant/components/technove/sensor.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update homeassistant/components/technove/models.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Remove unnecessary translation keys

* Fix existing technoVE tests

* Use snapshot testing for TechnoVE sensors

* Improve unit tests for TechnoVE

* Add missing coverage for technoVE config flow

* Add TechnoVE coordinator tests

* Modify device_fixture for TechnoVE from PR Feedback

* Change CONF_IP_ADDRESS to CONF_HOST for TechnoVE

* Update homeassistant/components/technove/config_flow.py

Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>

* Update homeassistant/components/technove/models.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update homeassistant/components/technove/models.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Implement feedback from TechnoVE PR

* Add test_sensor_update_failure to TechnoVE sensor tests

* Add test for error recovery during config flow of TechnoVE

* Remove test_coordinator.py from TechnoVE

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
2024-01-17 11:04:35 +01:00

26 lines
1 KiB
Python

"""Entity for TechnoVE."""
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN
from .coordinator import TechnoVEDataUpdateCoordinator
class TechnoVEEntity(CoordinatorEntity[TechnoVEDataUpdateCoordinator]):
"""Defines a base TechnoVE entity."""
_attr_has_entity_name = True
def __init__(self, coordinator: TechnoVEDataUpdateCoordinator, key: str) -> None:
"""Initialize a base TechnoVE entity."""
super().__init__(coordinator)
info = self.coordinator.data.info
self._attr_unique_id = f"{info.mac_address}_{key}"
self._attr_device_info = DeviceInfo(
connections={(CONNECTION_NETWORK_MAC, info.mac_address)},
identifiers={(DOMAIN, info.mac_address)},
name=info.name,
manufacturer="TechnoVE",
model=f"TechnoVE i{info.max_station_current}",
sw_version=info.version,
)