소스 검색

Don't mark devices available if they have not communicated.

A previous change to accept empty polls for devices that don't return data
(such as IR remotes) resulted in devices being marked available even when
they haven't returned any data. But this is not correct when the connection
has not been made at all.

However, we do not want to mark entities as disabled by default based on
the device not having communicated yet on startup, so add an extra condition
to avoid that.
Jason Rumney 1 년 전
부모
커밋
cb0516ed92
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      custom_components/tuya_local/helpers/device_config.py

+ 2 - 2
custom_components/tuya_local/helpers/device_config.py

@@ -353,7 +353,7 @@ class TuyaEntityConfig:
         avail_dp = self.find_dps("available")
         if avail_dp and device.has_returned_state:
             return avail_dp.get_value(device)
-        return True
+        return device.has_returned_state
 
     def enabled_by_default(self, device):
         """Return whether this entity should be disabled by default."""
@@ -366,7 +366,7 @@ class TuyaEntityConfig:
                     self._device.config_type,
                     self.name,
                 )
-            hidden = not self.available(device)
+            hidden = device.has_returned_state and not self.available(device)
         return not hidden and not self.deprecated