z4d-certified-devices 3.215__py3-none-any.whl → 4.216__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,8 @@
15
15
  "0005": "",
16
16
  "0006": "",
17
17
  "0102": {
18
- "Attributes": {
18
+ "Attributes": {
19
+ "f000": { "Enabled": true, "Name": "Tuya_0102_f000", "DataType": "30" , "ActionList": [ "check_store_value"]},
19
20
  "f002": { "Enabled": true, "Name": "Tuya_0102_f002", "DataType": "20" , "ActionList": [ "check_store_value"]},
20
21
  "f003": { "Enabled": true, "Name": "Tuya_0102_f002", "DataType": "21" , "ActionList": [ "check_store_value"]}
21
22
  }
@@ -1,66 +1,89 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Implementation of Zigbee for Domoticz plugin.
5
+ #
6
+ # This file is part of Zigbee for Domoticz plugin. https://github.com/zigbeefordomoticz/Domoticz-Zigbee
7
+ # (C) 2015-2024
8
+ #
9
+ # Initial authors: zaraki673 & pipiche38
10
+ #
11
+ # SPDX-License-Identifier: GPL-3.0 license
12
+
1
13
  import json
2
14
  import os.path
3
15
  from pathlib import Path
4
- from os import listdir
5
- from os.path import isdir, isfile, join
6
16
 
7
17
  from .version import __version__
8
18
 
9
19
 
10
20
  def z4d_import_device_configuration(self, path_name):
11
21
 
12
- # Read DeviceConf for backward compatibility
13
22
  model_certified = Path(path_name) / "Certified"
14
- plugin_version = self.pluginParameters["PluginVersion"]
23
+ plugin_version = self.pluginParameters.get("PluginVersion")
24
+
25
+ if not os.path.isdir(model_certified):
26
+ self.log.logging("z4dCertifiedDevices", "Status", f"none existing Z4D Certified Db at {model_certified} !!!")
27
+ return
28
+
29
+ for device_brand in os.listdir(model_certified):
30
+ if device_brand in ("README.md", ".PRECIOUS"):
31
+ continue
32
+
33
+ model_directory = model_certified / device_brand
34
+
35
+ for model_device_file in os.listdir(model_directory):
36
+ if model_device_file in ("README.md", ".PRECIOUS"):
37
+ continue
38
+
39
+ filename = model_directory / model_device_file
40
+ try:
41
+ with open(filename, "rt", encoding='utf-8') as file_handle:
42
+ model_definition = json.load(file_handle)
43
+
44
+ except ValueError as error:
45
+ self.log.logging("z4dCertifiedDevices", "Error", f"JSON ConfFile: {filename} load failed with error: {error}, skiping this config file.")
46
+ continue
47
+
48
+ except Exception as error:
49
+ self.log.logging("z4dCertifiedDevices", "Error", f"JSON ConfFile: {filename} load general error: {error}, skiping this config file.")
50
+ continue
51
+
52
+ device_model_name = _get_model_name(model_device_file )
53
+ if device_model_name in self.DeviceConf:
54
+ self.log.logging("z4dCertifiedDevices", "Debug", f"Config for {device_brand}/{device_model_name} not loaded as already defined")
55
+ continue
15
56
 
16
- if os.path.isdir(model_certified):
17
- model_brand_list = [f for f in listdir(model_certified) if isdir(join(model_certified, f))]
57
+ self.log.logging("z4dCertifiedDevices", "Debug", f"processing certified {device_brand}/{device_model_name}")
18
58
 
19
- for brand in model_brand_list:
20
- if brand in ("README.md", ".PRECIOUS"):
59
+ if not _is_model_requirement_match_plugin_version(self, model_definition, plugin_version):
60
+ self.log.logging( "z4dCertifiedDevices", "Error", f"Certified Devices load skip this Certified device %{device_brand}-{device_model_name} requires Plugin version {model_definition['MinPluginVersion']}")
21
61
  continue
22
62
 
23
- model_directory = model_certified / brand
24
-
25
- model_list = [f for f in listdir(model_directory) if isfile(join(model_directory, f))]
26
-
27
- for model_device in model_list:
28
- if model_device in ("README.md", ".PRECIOUS"):
29
- continue
30
-
31
- filename = model_directory / model_device
32
- with open(filename, "rt", encoding='utf-8') as handle:
33
- try:
34
- model_definition = json.load(handle)
35
- except ValueError as e:
36
- self.log.logging("z4dCertifiedDevices", "Error", "--> JSON ConfFile: %s load failed with error: %s" % (filename, str(e)))
37
- continue
38
- except Exception as e:
39
- self.log.logging("z4dCertifiedDevices", "Error", "--> JSON ConfFile: %s load general error: %s" % (filename, str(e)))
40
- continue
41
-
42
- try:
43
- device_model_name = model_device.rsplit(".", 1)[0]
44
- if device_model_name in self.DeviceConf:
45
- self.log.logging( "z4dCertifiedDevices", "Debug", "--> Config for %s/%s not loaded as already defined" % (str(brand), str(device_model_name)),)
46
- continue
47
-
48
- self.log.logging( "z4dCertifiedDevices", "Debug", "--> Config for %s/%s" % (str(brand), str(device_model_name)))
49
- if "MinPluginVersion" in model_definition and plugin_version < model_definition["MinPluginVersion"]:
50
- self.log.logging( "z4dCertifiedDevices", "Log", "Certified Devices load skip this Certified device %s-%s requires Plugin version %s" % (
51
- str(brand), str(device_model_name), model_definition["MinPluginVersion"] ),)
52
- continue
53
-
54
- self.DeviceConf[device_model_name] = dict(model_definition)
55
- if "Identifier" in model_definition:
56
- self.log.logging( "z4dCertifiedDevices", "Debug", "--> Identifier found %s" % (str(model_definition["Identifier"])) )
57
- for x in model_definition["Identifier"]:
58
- self.log.logging( "z4dCertifiedDevices", "Debug", "--> %s" %x)
59
- self.ModelManufMapping[ (x[0], x[1] )] = device_model_name
60
-
61
- except Exception:
62
- self.log.logging("z4dCertifiedDevices", "Error", "--> Unexpected error when loading a configuration file")
63
-
64
- self.log.logging("z4dCertifiedDevices", "Debug", "--> Config loaded: %s" % self.DeviceConf.keys())
65
- self.log.logging("z4dCertifiedDevices", "Debug", "Certified Devices ModelManufMapping loaded - %s" %self.ModelManufMapping.keys())
66
- self.log.logging("z4dCertifiedDevices", "Status", "Certified Devices loaded - %s confs loaded" %len(self.DeviceConf))
63
+ _process_device_config_file(self, device_model_name, model_definition)
64
+
65
+ self.log.logging("z4dCertifiedDevices", "Debug", f"Config loaded: {self.DeviceConf.keys()}")
66
+ self.log.logging("z4dCertifiedDevices", "Debug", f"Certified Devices ModelManufMapping loaded - {self.ModelManufMapping.keys()}")
67
+
68
+ self.log.logging("z4dCertifiedDevices", "Status", f"{len(self.DeviceConf)} Certified devices loaded from z4d repository.")
69
+
70
+ def _get_model_name(model_device_file ):
71
+ """ Purpose is to remove .json from filename to get the Device Model"""
72
+ basename = os.path.basename(model_device_file)
73
+ device_model_name = os.path.splitext(basename)[0]
74
+ return device_model_name
75
+
76
+
77
+ def _is_model_requirement_match_plugin_version(self, model_definition, plugin_version):
78
+ """ is the config file working with this version of the plugin """
79
+ return not ("MinPluginVersion" in model_definition and plugin_version < model_definition["MinPluginVersion"])
80
+
81
+
82
+ def _process_device_config_file(self, device_model_name, model_definition):
83
+ """ let's load the config into DeviceConf , and if needed (Tuya) lets also load into the model name mapping"""
84
+ self.DeviceConf[device_model_name] = dict(model_definition)
85
+ if "Identifier" not in model_definition:
86
+ return
87
+ for identifier_tuple in model_definition["Identifier"]:
88
+ self.ModelManufMapping[ tuple(identifier_tuple) ] = device_model_name
89
+
@@ -1,3 +1,3 @@
1
- MAJOR_VERSION = 3
2
- MINOR_VERSION = 215
1
+ MAJOR_VERSION = 4
2
+ MINOR_VERSION = 216
3
3
  __version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: z4d-certified-devices
3
- Version: 3.215
3
+ Version: 4.216
4
4
  Summary: "Certified devices for Zigbee for Domoticz plugin"
5
5
  Home-page: https://github.com/zigbeefordomoticz/z4d-certified-devices
6
6
  Author: "Patrick Pichon"
@@ -1,5 +1,5 @@
1
- z4d_certified_devices/__init__.py,sha256=wdYFaADr5SrC5bXe1OBsrmpfJ7J6GN0H22o49UA4_Es,3533
2
- z4d_certified_devices/version.py,sha256=k2yVt36z12knLI1f7TtRRqLn3Yl1cKxMjLY5C7S_UuM,87
1
+ z4d_certified_devices/__init__.py,sha256=i5sQ3ShnztbqZ3IeUr-smCqhcYLIaHZP5fkIoTXQZIo,3938
2
+ z4d_certified_devices/version.py,sha256=nhitgsczADllPNQdvNMwO-BMwffB0xFqRF7_rPfvDm8,87
3
3
  z4d_certified_devices/Certified/README.md,sha256=1WnlKFf_NJon6zCJ0zfbBIOHES0L2YoE9EjzI2zhlDA,1415
4
4
  z4d_certified_devices/Certified/Adeo/LDSENK02F.json,sha256=eYpL0-1uta51sAzIpg7wIqUdl9AC16vYkrXZgW7AtA0,2067
5
5
  z4d_certified_devices/Certified/Adeo/LDSENK10.json,sha256=G_Z1dpeZv0kuJ9te9hsFOfdjQx-1FIFTf8F9gC5PZYA,843
@@ -528,7 +528,7 @@ z4d_certified_devices/Certified/Tuya/TS110F-2gang-dimmer.json,sha256=sa2uGLndg8x
528
528
  z4d_certified_devices/Certified/Tuya/TS110F-_TYZB01_qezuin6k.json,sha256=Xpj2aJZDmrO6JCz36JIF-QynFMwXh1hBKfmBVvU5JyQ,691
529
529
  z4d_certified_devices/Certified/Tuya/TS110F-_TZ3000_ktuoyvt5.json,sha256=dYqDJ0aC2sbNSTBrbkC117lJVR8CdpIYzvSBKXCqO6Q,605
530
530
  z4d_certified_devices/Certified/Tuya/TS110F-dimmer.json,sha256=dmXGs3TuUxj0UKA0PRxzH924lY7od663Y6FnUHG1qrk,886
531
- z4d_certified_devices/Certified/Tuya/TS130F-Blind.json,sha256=CEscNNRBqUzMNfPjXU8njLnfGLfx2wNba1fXlufA0Q4,1417
531
+ z4d_certified_devices/Certified/Tuya/TS130F-Blind.json,sha256=T-2gvwkU7H7sSZLlpzQtR0lMDrsCEp7h05Q-5K79eh0,1547
532
532
  z4d_certified_devices/Certified/Tuya/TS130F-_TZ3000_1dd0d5yi-Blind.json,sha256=dvuNEF-OKc6rH2v8BFEWeHA8xLFKZTrmWWsrhsd0CcM,1094
533
533
  z4d_certified_devices/Certified/Tuya/TS130F-_TZ3000_1dd0d5yi-Vanne.json,sha256=UbvH2DCQJg2gBwZi-L5EvLHUZsjthfUAAP1jho3s8zQ,1112
534
534
  z4d_certified_devices/Certified/Tuya/TS130F-_TZ3000_1dd0d5yi.json,sha256=Okz7fbPw0RkeNC4BPEIlu_Jyg3lxgG-DVxDdqkEWbik,1115
@@ -556,9 +556,9 @@ z4d_certified_devices/Certified/eWeLink/SA-003-Zigbee.json,sha256=PHqliTZ0_8a7F_
556
556
  z4d_certified_devices/Certified/eWeLink/SA-030-1.json,sha256=PHqliTZ0_8a7F_hbRVIVQ9A-sJipGrBD1jzhgkKJRvw,833
557
557
  z4d_certified_devices/Certified/eWeLink/SWITCH-ZR02.json,sha256=poSWAakR1iWJyvCXx5vgjYga38l6QYZM5C0MSk5vqas,835
558
558
  z4d_certified_devices/Certified/eWeLink/SWITCH-ZR03-1.json,sha256=poSWAakR1iWJyvCXx5vgjYga38l6QYZM5C0MSk5vqas,835
559
- z4d_certified_devices-3.215.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
560
- z4d_certified_devices-3.215.dist-info/METADATA,sha256=pC-qSYQYL9JnLMqXmtxeIY1jEQ7yMlACij8EHxT8cVo,36878
561
- z4d_certified_devices-3.215.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
562
- z4d_certified_devices-3.215.dist-info/top_level.txt,sha256=dZpL9ibb5CtTAY-pS-wGk-1jh9d-q04ogJ-Dfskashk,22
563
- z4d_certified_devices-3.215.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
564
- z4d_certified_devices-3.215.dist-info/RECORD,,
559
+ z4d_certified_devices-4.216.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
560
+ z4d_certified_devices-4.216.dist-info/METADATA,sha256=fFxxo-DCZeQ__njEvAuWRX-6ad4vMbaKTrK_leXkvnQ,36878
561
+ z4d_certified_devices-4.216.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
562
+ z4d_certified_devices-4.216.dist-info/top_level.txt,sha256=dZpL9ibb5CtTAY-pS-wGk-1jh9d-q04ogJ-Dfskashk,22
563
+ z4d_certified_devices-4.216.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
564
+ z4d_certified_devices-4.216.dist-info/RECORD,,