Add support for entity category for necessary KNX platforms (#58357)

This commit is contained in:
Marvin Wichmann 2021-10-25 05:12:26 +02:00 committed by GitHub
parent f3a1c81e22
commit e9ca511327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 84 additions and 10 deletions

View file

@ -5,7 +5,7 @@ from xknx import XKNX
from xknx.devices import Weather as XknxWeather
from homeassistant.components.weather import WeatherEntity
from homeassistant.const import CONF_NAME, TEMP_CELSIUS
from homeassistant.const import CONF_ENTITY_CATEGORY, CONF_NAME, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@ -78,6 +78,7 @@ class KNXWeather(KnxEntity, WeatherEntity):
"""Initialize of a KNX sensor."""
super().__init__(_create_weather(xknx, config))
self._attr_unique_id = str(self._device._temperature.group_address_state)
self._attr_entity_category = config.get(CONF_ENTITY_CATEGORY)
@property
def temperature(self) -> float | None: