فهرست منبع

fix (siren): avoid clobbering the tone by trying to set it to null

When the tone does not need setting, the value is null, but the code was
blindly setting the tone even in this case. Check for null first, and skip
setting tone in that case.

PR #4048
Jason Rumney 5 ماه پیش
والد
کامیت
f8ad6fb317
1فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 5 4
      custom_components/tuya_local/siren.py

+ 5 - 4
custom_components/tuya_local/siren.py

@@ -87,10 +87,11 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
                 if tone == "off":
                     tone = self._default_tone
 
-            set_dps = {
-                **set_dps,
-                **self._tone_dp.get_values_to_set(self._device, tone, set_dps),
-            }
+            if tone is not None:
+                set_dps = {
+                    **set_dps,
+                    **self._tone_dp.get_values_to_set(self._device, tone, set_dps),
+                }
 
         if duration is not None and self._duration_dp:
             set_dps = {