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

ci(device_config): detect device ids inserted as product ids.

Remove detected device ids from existing configs.
Some model ids are left as comments, as these do not identify
individual devices.
Jason Rumney 4 недель назад
Родитель
Сommit
73331b2b4d
21 измененных файлов с 85 добавлено и 80 удалено
  1. 4 4
      custom_components/tuya_local/devices/advancedfires_1500_fireplace.yaml
  2. 4 4
      custom_components/tuya_local/devices/amico_smart_ceiling_fan.yaml
  3. 4 4
      custom_components/tuya_local/devices/bauhn_ap5w0624_powerstrip.yaml
  4. 3 3
      custom_components/tuya_local/devices/ble_water_valve.yaml
  5. 4 4
      custom_components/tuya_local/devices/blitzwolf_bwsh2_humidifier.yaml
  6. 4 4
      custom_components/tuya_local/devices/comfortzone_cztf423s_towerfan.yaml
  7. 7 5
      custom_components/tuya_local/devices/dekala_lumos_alarm_clock.yaml
  8. 4 4
      custom_components/tuya_local/devices/djive_arc_fan.yaml
  9. 4 4
      custom_components/tuya_local/devices/electriq_pd45e_dehumidifier.yaml
  10. 4 4
      custom_components/tuya_local/devices/gidrolock_standard_wifi.yaml
  11. 4 4
      custom_components/tuya_local/devices/inkbird_iaqm129w_airqualitymonitor.yaml
  12. 5 4
      custom_components/tuya_local/devices/inkbird_int12bw_thermometer.yaml
  13. 3 3
      custom_components/tuya_local/devices/ir_moes_heatpump.yaml
  14. 4 4
      custom_components/tuya_local/devices/jiahong_et44w_thermostat.yaml
  15. 4 4
      custom_components/tuya_local/devices/klarstein_wonderwall_irheater.yaml
  16. 4 4
      custom_components/tuya_local/devices/marpou_ceiling_lamp_ledlight.yaml
  17. 4 4
      custom_components/tuya_local/devices/probreeze_pb20.yaml
  18. 4 4
      custom_components/tuya_local/devices/qlima_d820a_dehumidifier.yaml
  19. 3 3
      custom_components/tuya_local/devices/smartplugv1.yaml
  20. 5 5
      custom_components/tuya_local/devices/zemismart_spm02d2tw_energymeter.yaml
  21. 3 1
      tests/test_device_config.py

+ 4 - 4
custom_components/tuya_local/devices/advancedfires_1500_fireplace.yaml

@@ -1,8 +1,8 @@
 name: Electric fireplace
-products:
-  - id: bf773f569661709b88gzbb
-    manufacturer: Advanced Fires
-    model: "1500"
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Advanced Fires
+#     model: "1500"
 entities:
   - entity: climate
     dps:

+ 4 - 4
custom_components/tuya_local/devices/amico_smart_ceiling_fan.yaml

@@ -1,8 +1,8 @@
 name: Ceiling fan
-products:
-  - id: eb208a14315d7cb2bd6txt
-    manufacturer: Amico
-    name: "52 inch ceiling fan"
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Amico
+#     name: "52 inch ceiling fan"
 entities:
   - entity: fan
     translation_only_key: fan_with_presets

+ 4 - 4
custom_components/tuya_local/devices/bauhn_ap5w0624_powerstrip.yaml

@@ -1,8 +1,8 @@
 name: 5-way powerstrip
-products:
-  - id: bf152cecbcf4180771k2lq
-    manufacturer: Bauhn
-    model: AP5W-0624
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Bauhn
+#     model: AP5W-0624
 entities:
   - entity: switch
     translation_key: outlet_x

+ 3 - 3
custom_components/tuya_local/devices/ble_water_valve.yaml

@@ -3,9 +3,9 @@ legacy_type: ble_johgee_water_valve
 products:
   - id: c8800fd30884068f
     manufacturer: Johgee
-  - id: bfc513e1f9d4d259a10wzu
-    manufacturer: Diivoo
-    model: WT-03
+  # - id: UNKNOWN
+  #   manufacturer: Diivoo
+  #   model: WT-03
   - id: nxquc5lb
     manufacturer: Insoma
     model: SOP10

+ 4 - 4
custom_components/tuya_local/devices/blitzwolf_bwsh2_humidifier.yaml

@@ -1,9 +1,9 @@
 # sample DPS {'1': False, '3': 'grade1', '6': 'close', 19: 'cancel'}
 name: Humidifier
-products:
-  - id: 20268362d8bfc0080ec9
-    manufacturer: BlitzWolf
-    model: BWSH2
+# products:
+#   - id: UNKNOWN
+#     manufacturer: BlitzWolf
+#     model: BWSH2
 entities:
   - entity: fan
     icon: "mdi:humidifier"

+ 4 - 4
custom_components/tuya_local/devices/comfortzone_cztf423s_towerfan.yaml

@@ -1,8 +1,8 @@
 name: Tower Fan
-products:
-  - id: eb414680be46558e014mtb
-    manufacturer: Comfort Zone
-    model: CZTF423S
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Comfort Zone
+#     model: CZTF423S
 entities:
   - entity: fan
     translation_key: fan_with_presets

+ 7 - 5
custom_components/tuya_local/devices/dekala_lumos_alarm_clock.yaml

@@ -22,11 +22,11 @@
 
 name: Sunrise alarm clock
 
-products:
-  - id: e1xp7w
-    manufacturer: Dekala
-    model: Dekala Lumos
-    model_id: e1xp7w
+# products:
+#   - id: e1xp7w
+#     manufacturer: Dekala
+#     model: Dekala Lumos
+#     model_id: e1xp7w
 
 entities:
   - entity: light
@@ -736,6 +736,7 @@ entities:
       - id: 130
         name: switch
         type: boolean
+        optional: true
 
   # FM tuning is only available while the radio is on (DP 130).
   - entity: number
@@ -804,6 +805,7 @@ entities:
       - id: 115
         name: switch
         type: boolean
+        optional: true
 
   - entity: switch
     translation_key: night_mode

+ 4 - 4
custom_components/tuya_local/devices/djive_arc_fan.yaml

@@ -1,8 +1,8 @@
 name: Humidifying fan
-products:
-  - id: bf5fd02f13d3f6d92exy2t
-    manufacturer: djive
-    model: Flowmate ARC
+# products:
+#   - id: UNKNOWN
+#     manufacturer: djive
+#     model: Flowmate ARC
 entities:
   - entity: fan
     dps:

+ 4 - 4
custom_components/tuya_local/devices/electriq_pd45e_dehumidifier.yaml

@@ -1,8 +1,8 @@
 name: Dehumidifier
-products:
-  - id: 75174020a4e57c1945ca
-    manufacturer: Electriq
-    model: PD45E
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Electriq
+#     model: PD45E
 entities:
   - entity: humidifier
     class: dehumidifier

+ 4 - 4
custom_components/tuya_local/devices/gidrolock_standard_wifi.yaml

@@ -1,8 +1,8 @@
 name: Water leak detector
-products:
-  - id: bfb8a9376cc12866d7rhfv
-    manufacturer: Gidrolock
-    model: Standard WiFi
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Gidrolock
+#     model: Standard WiFi
 entities:
   - entity: valve
     class: water

+ 4 - 4
custom_components/tuya_local/devices/inkbird_iaqm129w_airqualitymonitor.yaml

@@ -1,8 +1,8 @@
 name: Air quality monitor
-products:
-  - id: UNKNOWN
-    manufacturer: Inkbird
-    model: IAQM-129-W
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Inkbird
+#     model: IAQM-129-W
 entities:
   - entity: sensor
     translation_key: air_quality

+ 5 - 4
custom_components/tuya_local/devices/inkbird_int12bw_thermometer.yaml

@@ -1,8 +1,8 @@
 name: BBQ thermometer
-products:
-  - id: lkrzzdaex96syshadps
-    model: INT-12-BW
-    manufacturer: Inkbird
+# products:
+#   - id: UNKNOWN
+#     model: INT-12-BW
+#     manufacturer: Inkbird
 
 # Probe1 is the black probe
 # Probe2 is the white probe
@@ -387,6 +387,7 @@ entities:
     dps:
       - id: 109
         type: base64
+        optional: true
         name: sensor
 
   - entity: sensor

+ 3 - 3
custom_components/tuya_local/devices/ir_moes_heatpump.yaml

@@ -1,8 +1,8 @@
 name: IR heat pump
 products:
-  - id: hwktwkq
-    manufacturer: Moes
-    model: SD16Pro
+  # - id: hwktwkq
+  #   manufacturer: Moes
+  #   model: SD16Pro
   - id: aqlyorlybbtn6ox7
     manufacturer: Moes
     name: IR thermostat

+ 4 - 4
custom_components/tuya_local/devices/jiahong_et44w_thermostat.yaml

@@ -1,8 +1,8 @@
 name: Thermostat
-products:
-  - id: e4e7k8
-    manufacturer: TheroLife
-    model: ET44W
+# products:
+#   - id: e4e7k8
+#     manufacturer: TheroLife
+#     model: ET44W
 entities:
   - entity: climate
     translation_key: thermostat

+ 4 - 4
custom_components/tuya_local/devices/klarstein_wonderwall_irheater.yaml

@@ -1,8 +1,8 @@
 name: IR heater
-products:
-  - id: bf5fa857bcc2d892dc2akt
-    manufacturer: Klarstein
-    model: Wonderwall
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Klarstein
+#     model: Wonderwall
 entities:
   - entity: climate
     translation_only_key: heater

+ 4 - 4
custom_components/tuya_local/devices/marpou_ceiling_lamp_ledlight.yaml

@@ -1,8 +1,8 @@
 name: RGB ceiling light
-products:
-  - id: eb93523c41813016ac6ay1
-    manufacturer: Marpou
-    name: Five way ceiling lamp
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Marpou
+#     name: Five way ceiling lamp
 entities:
   - entity: light
     icon: "mdi:wall-sconce-flat-outline"

+ 4 - 4
custom_components/tuya_local/devices/probreeze_pb20.yaml

@@ -1,8 +1,8 @@
 name: Dehumidifier
-products:
-  - id: bfaa8cc446a9c7a142bp7o
-    manufacturer: Pro Breeze
-    model: PB-20
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Pro Breeze
+#     model: PB-20
 entities:
   - entity: humidifier
     class: dehumidifier

+ 4 - 4
custom_components/tuya_local/devices/qlima_d820a_dehumidifier.yaml

@@ -1,8 +1,8 @@
 name: Dehumidifier
-products:
-  - id: bfba28a17b4fe4e87aljv2
-    manufacturer: Qlima
-    model: D820A
+# products:
+#   - id: UNKNOWN
+#     manufacturer: Qlima
+#     model: D820A
 entities:
   - entity: humidifier
     class: dehumidifier

+ 3 - 3
custom_components/tuya_local/devices/smartplugv1.yaml

@@ -1,9 +1,9 @@
 name: Energy monitoring smartplug
 legacy_type: kogan_switch
 products:
-  - id: "370053454855194e5607"
-    manufacturer: Gosund
-    model: EP2
+  # - id: UNKNOWN
+  #   manufacturer: Gosund
+  #   model: EP2
   - id: 37mnhia3pojleqfh
     model: SP111-A
   - id: kOKEJBFoF9VNB5FR

+ 5 - 5
custom_components/tuya_local/devices/zemismart_spm02d2tw_energymeter.yaml

@@ -1,9 +1,9 @@
 name: Energy meter
-products:
-  - id: g5n4t0
-    manufacturer: Zemismart
-    model_id: SPM02-D2TW
-    model: 3-Phase Energy Meter
+# products:
+#   - id: g5n4t0
+#     manufacturer: Zemismart
+#     model_id: SPM02-D2TW
+#     model: 3-Phase Energy Meter
 entities:
   # Total energy consumed
   - entity: sensor

+ 3 - 1
tests/test_device_config.py

@@ -22,7 +22,9 @@ from .helpers import assert_device_properties_set, mock_device
 
 PRODUCT_SCHEMA = vol.Schema(
     {
-        vol.Required("id"): str,
+        # Bluetooth and Zigbee devices have 8 character product ids
+        # WiFi devices have 16 character product ids
+        vol.Required("id"): vol.All(str, vol.Length(min=8, max=16)),
         vol.Optional("name"): str,
         vol.Optional("manufacturer"): str,
         vol.Optional("model"): str,