mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
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:
parent
93aa31c835
commit
2c196baa7a
@ -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."
|
||||
|
@ -7,6 +7,7 @@ PARAMETERS = "parameters"
|
||||
DEVICE_ID = "device_id"
|
||||
DEVICE_GATEWAY = "device_gateway"
|
||||
DEVICE_NAME = "device_name"
|
||||
MANUFACTURER = "WOLF GmbH"
|
||||
|
||||
STATES = {
|
||||
"Ein": "ein",
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user