From 369c6cc06b8635ca24bb18933e7f2fb4f013d3ed Mon Sep 17 00:00:00 2001 From: Thomas Germain <12560542+thomasgermain@users.noreply.github.com> Date: Sat, 30 Sep 2023 11:02:33 +0200 Subject: [PATCH] fix: remove diagnostic category for some entities (#228) --- custom_components/multimatic/binary_sensor.py | 43 +------------------ custom_components/multimatic/manifest.json | 2 +- custom_components/multimatic/sensor.py | 17 +------- 3 files changed, 3 insertions(+), 59 deletions(-) diff --git a/custom_components/multimatic/binary_sensor.py b/custom_components/multimatic/binary_sensor.py index d5fe5a1..253f84b 100644 --- a/custom_components/multimatic/binary_sensor.py +++ b/custom_components/multimatic/binary_sensor.py @@ -15,8 +15,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import EntityCategory from homeassistant.core import HomeAssistant -from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC -from homeassistant.helpers.entity import DeviceInfo +from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util import slugify @@ -116,11 +115,6 @@ def name(self) -> str: """Return the name of the entity.""" return self.coordinator.data.circulation.name - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - @property def device_class(self) -> BinarySensorDeviceClass | None: """Return the class of this device, from component DEVICE_CLASSES.""" @@ -162,11 +156,6 @@ def room(self) -> Room: """Return the room.""" return self.coordinator.find_component(self._room_id) - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class RoomDeviceEntity(MultimaticEntity, BinarySensorEntity): """Base class for ambisense device.""" @@ -255,11 +244,6 @@ def device_class(self) -> BinarySensorDeviceClass | None: """Return the class of this device, from component DEVICE_CLASSES.""" return BinarySensorDeviceClass.LOCK - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class RoomDeviceBattery(RoomDeviceEntity): """Represent a device battery.""" @@ -403,11 +387,6 @@ def device_class(self) -> BinarySensorDeviceClass | None: """Return the class of this device, from component DEVICE_CLASSES.""" return BinarySensorDeviceClass.CONNECTIVITY - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class BoilerStatus(MultimaticEntity, BinarySensorEntity): """Check if there is some error.""" @@ -476,11 +455,6 @@ def device_class(self) -> BinarySensorDeviceClass | None: """Return the class of this device, from component DEVICE_CLASSES.""" return BinarySensorDeviceClass.PROBLEM - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class MultimaticErrors(MultimaticEntity, BinarySensorEntity): """Check if there is any error message from system.""" @@ -529,11 +503,6 @@ def name(self) -> str: """Return the name of the entity.""" return "Multimatic Errors" - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class HolidayModeSensor(MultimaticEntity, BinarySensorEntity): """Binary sensor for holiday mode.""" @@ -568,11 +537,6 @@ def available(self) -> bool: """Return if entity is available.""" return self.coordinator.last_update_success - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - @property def device_class(self) -> BinarySensorDeviceClass | None: """Return the class of this device, from component DEVICE_CLASSES.""" @@ -611,11 +575,6 @@ def available(self) -> bool: """Return if entity is available.""" return self.coordinator.last_update_success - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - @property def device_class(self) -> BinarySensorDeviceClass | None: """Return the class of this device, from component DEVICE_CLASSES.""" diff --git a/custom_components/multimatic/manifest.json b/custom_components/multimatic/manifest.json index 4ec0e0f..1470ae1 100644 --- a/custom_components/multimatic/manifest.json +++ b/custom_components/multimatic/manifest.json @@ -12,7 +12,7 @@ "homekit": {}, "dependencies": [], "codeowners": ["@thomasgermain"], - "version": "1.15.0", + "version": "1.15.1", "iot_class": "cloud_polling", "integration_type": "hub" } diff --git a/custom_components/multimatic/sensor.py b/custom_components/multimatic/sensor.py index 3e1ddde..a6e8a56 100644 --- a/custom_components/multimatic/sensor.py +++ b/custom_components/multimatic/sensor.py @@ -15,7 +15,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import UnitOfEnergy, UnitOfTemperature from homeassistant.core import HomeAssistant -from homeassistant.helpers.entity import DeviceInfo, EntityCategory +from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import StateType @@ -96,11 +96,6 @@ def state_class(self) -> str | None: """Return the state class of this entity.""" return SensorStateClass.MEASUREMENT - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class ReportSensor(MultimaticEntity, SensorEntity): """Report sensor.""" @@ -169,11 +164,6 @@ def name(self) -> str | None: """Return the name of the entity.""" return self._name - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC - class EmfReportSensor(MultimaticEntity, SensorEntity): """Emf Report sensor.""" @@ -236,8 +226,3 @@ def name(self) -> str | None: def state_class(self) -> str: """Return the state class of this entity.""" return SensorStateClass.TOTAL_INCREASING - - @property - def entity_category(self) -> EntityCategory | None: - """Return the category of the entity, if any.""" - return EntityCategory.DIAGNOSTIC