Add DeviceInfo to Wolf SmartSet Entities (#104642)

* Fix await warning

* Add DeviceInfo to Wolflink sensors

* Remove comment

* Don't pass device name to DeviceInfo

* Use _attr_device_info instead of property
This commit is contained in:
Adrian Huber 2023-11-28 22:24:25 +01:00 committed by GitHub
parent 93aa31c835
commit 2c196baa7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -51,7 +51,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
nonlocal refetch_parameters
nonlocal parameters
await wolf_client.update_session()
if not wolf_client.fetch_system_state_list(device_id, gateway_id):
if not await wolf_client.fetch_system_state_list(device_id, gateway_id):
refetch_parameters = True
raise UpdateFailed(
"Could not fetch values from server because device is Offline."

View File

@ -7,6 +7,7 @@ PARAMETERS = "parameters"
DEVICE_ID = "device_id"
DEVICE_GATEWAY = "device_gateway"
DEVICE_NAME = "device_name"
MANUFACTURER = "WOLF GmbH"
STATES = {
"Ein": "ein",

View File

@ -15,10 +15,11 @@ from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfPressure, UnitOfTemperature, UnitOfTime
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import COORDINATOR, DEVICE_ID, DOMAIN, PARAMETERS, STATES
from .const import COORDINATOR, DEVICE_ID, DOMAIN, MANUFACTURER, PARAMETERS, STATES
async def async_setup_entry(
@ -60,6 +61,11 @@ class WolfLinkSensor(CoordinatorEntity, SensorEntity):
self._attr_name = wolf_object.name
self._attr_unique_id = f"{device_id}:{wolf_object.parameter_id}"
self._state = None
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, device_id)},
configuration_url="https://www.wolf-smartset.com/",
manufacturer=MANUFACTURER,
)
@property
def native_value(self):