소스 검색

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 4 년 전
부모
커밋
9823364bbf
1개의 변경된 파일1개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 6
      custom_components/tuya_local/helpers/device_config.py

+ 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):