File tree 1 file changed +11
-0
lines changed
custom_components/nodered
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 7
7
from homeassistant .components .sensor import SensorDeviceClass , SensorEntity
8
8
from homeassistant .const import CONF_STATE , CONF_UNIT_OF_MEASUREMENT
9
9
from homeassistant .helpers .dispatcher import async_dispatcher_connect
10
+ from homeassistant .helpers .entity import EntityCategory
10
11
11
12
from . import NodeRedEntity
12
13
from .const import (
@@ -101,3 +102,13 @@ def update_discovery_config(self, msg):
101
102
)
102
103
self ._attr_unit_of_measurement = None
103
104
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
You can’t perform that action at this time.
0 commit comments