Skip to content

Commit 5607880

Browse files
committed
fix: Change sensors with the category config to none
Fixes #225
1 parent 8daefb4 commit 5607880

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

custom_components/nodered/sensor.py

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
88
from homeassistant.const import CONF_STATE, CONF_UNIT_OF_MEASUREMENT
99
from homeassistant.helpers.dispatcher import async_dispatcher_connect
10+
from homeassistant.helpers.entity import EntityCategory
1011

1112
from . import NodeRedEntity
1213
from .const import (
@@ -101,3 +102,13 @@ def update_discovery_config(self, msg):
101102
)
102103
self._attr_unit_of_measurement = None
103104
self._attr_state_class = msg[CONF_CONFIG].get(CONF_STATE_CLASS)
105+
106+
def entity_category_mapper(self, category):
107+
"""Map Node-RED category to Home Assistant entity category."""
108+
if category == "config":
109+
_LOGGER.warning(
110+
f"Sensor {self.name} has category 'config' which is not supported"
111+
)
112+
if category == "diagnostic":
113+
return EntityCategory.DIAGNOSTIC
114+
return None

0 commit comments

Comments
 (0)