Просмотр исходного кода

Somgom single switch: allow init when initial state is missing

Initial state dp is optional, but there was no listing for the null case.
List the options so that the select entity is created correctly.

Issue #1487
Jason Rumney 2 лет назад
Родитель
Сommit
2ef33b74a8
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      custom_components/tuya_local/devices/somgom_single_switch.yaml

+ 9 - 0
custom_components/tuya_local/devices/somgom_single_switch.yaml

@@ -52,6 +52,15 @@ secondary_entities:
                     value: "On"
                   - dps_val: memory
                     value: Last state
+              # during startup there may be no value, but we need to know the options
+              - dps_val: null
+                mapping:
+                  - dps_val: "off"
+                    value: "Off"
+                  - dps_val: "on"
+                    value: "On"
+                  - dps_val: memory
+                    value: "Last state"
   - entity: light
     name: Backlight
     category: config