Ver código fonte

Siren: support turn on/off if the siren has a switch

Currently turn on/off is only defined by the tone dp being available,
but it should also be available if there is a switch dp.

Issue #3002
Jason Rumney 9 meses atrás
pai
commit
2c593286b2
1 arquivos alterados com 3 adições e 0 exclusões
  1. 3 0
      custom_components/tuya_local/siren.py

+ 3 - 0
custom_components/tuya_local/siren.py

@@ -61,6 +61,9 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
             support |= SirenEntityFeature.VOLUME_SET
             support |= SirenEntityFeature.VOLUME_SET
         if self._duration_dp:
         if self._duration_dp:
             support |= SirenEntityFeature.DURATION
             support |= SirenEntityFeature.DURATION
+        if self._switch_dp:
+            support |= SirenEntityFeature.TURN_ON | SirenEntityFeature.TURN_OFF
+
         self._attr_supported_features = support
         self._attr_supported_features = support
 
 
     @property
     @property