Procházet zdrojové kódy

Get entity category explicitly from config file.

Initially when I added this feature after 2021.11 HA release, I was looking
for a quick solution that did not involve mass editing all the existing
configs.  But in the course of other changes, I have done that anyway, and
added category attributes to secondary entities as I went.

Some secondary entities are just as important as the primary entity -
for example in a multi-switch powerboard, each switch is equal to the others,
and we shouldn't have one displaying as the main entity with others
demoted to config entities where Alexa/Google/Siri will not see them.
Jason Rumney před 4 roky
rodič
revize
9823364bbf

+ 1 - 6
custom_components/tuya_local/helpers/device_config.py

@@ -162,12 +162,7 @@ class TuyaEntityConfig:
 
     @property
     def entity_category(self):
-        if self._is_primary:
-            return None
-        elif self.entity in ["binary_sensor", "sensor"]:
-            return "diagnostic"
-        else:
-            return "config"
+        return self._config.get("category")
 
     @property
     def deprecated(self):