aiohomematic 2026.1.29__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.
Files changed (188) hide show
  1. aiohomematic/__init__.py +110 -0
  2. aiohomematic/_log_context_protocol.py +29 -0
  3. aiohomematic/api.py +410 -0
  4. aiohomematic/async_support.py +250 -0
  5. aiohomematic/backend_detection.py +462 -0
  6. aiohomematic/central/__init__.py +103 -0
  7. aiohomematic/central/async_rpc_server.py +760 -0
  8. aiohomematic/central/central_unit.py +1152 -0
  9. aiohomematic/central/config.py +463 -0
  10. aiohomematic/central/config_builder.py +772 -0
  11. aiohomematic/central/connection_state.py +160 -0
  12. aiohomematic/central/coordinators/__init__.py +38 -0
  13. aiohomematic/central/coordinators/cache.py +414 -0
  14. aiohomematic/central/coordinators/client.py +480 -0
  15. aiohomematic/central/coordinators/connection_recovery.py +1141 -0
  16. aiohomematic/central/coordinators/device.py +1166 -0
  17. aiohomematic/central/coordinators/event.py +514 -0
  18. aiohomematic/central/coordinators/hub.py +532 -0
  19. aiohomematic/central/decorators.py +184 -0
  20. aiohomematic/central/device_registry.py +229 -0
  21. aiohomematic/central/events/__init__.py +104 -0
  22. aiohomematic/central/events/bus.py +1392 -0
  23. aiohomematic/central/events/integration.py +424 -0
  24. aiohomematic/central/events/types.py +194 -0
  25. aiohomematic/central/health.py +762 -0
  26. aiohomematic/central/rpc_server.py +353 -0
  27. aiohomematic/central/scheduler.py +794 -0
  28. aiohomematic/central/state_machine.py +391 -0
  29. aiohomematic/client/__init__.py +203 -0
  30. aiohomematic/client/_rpc_errors.py +187 -0
  31. aiohomematic/client/backends/__init__.py +48 -0
  32. aiohomematic/client/backends/base.py +335 -0
  33. aiohomematic/client/backends/capabilities.py +138 -0
  34. aiohomematic/client/backends/ccu.py +487 -0
  35. aiohomematic/client/backends/factory.py +116 -0
  36. aiohomematic/client/backends/homegear.py +294 -0
  37. aiohomematic/client/backends/json_ccu.py +252 -0
  38. aiohomematic/client/backends/protocol.py +316 -0
  39. aiohomematic/client/ccu.py +1857 -0
  40. aiohomematic/client/circuit_breaker.py +459 -0
  41. aiohomematic/client/config.py +64 -0
  42. aiohomematic/client/handlers/__init__.py +40 -0
  43. aiohomematic/client/handlers/backup.py +157 -0
  44. aiohomematic/client/handlers/base.py +79 -0
  45. aiohomematic/client/handlers/device_ops.py +1085 -0
  46. aiohomematic/client/handlers/firmware.py +144 -0
  47. aiohomematic/client/handlers/link_mgmt.py +199 -0
  48. aiohomematic/client/handlers/metadata.py +436 -0
  49. aiohomematic/client/handlers/programs.py +144 -0
  50. aiohomematic/client/handlers/sysvars.py +100 -0
  51. aiohomematic/client/interface_client.py +1304 -0
  52. aiohomematic/client/json_rpc.py +2068 -0
  53. aiohomematic/client/request_coalescer.py +282 -0
  54. aiohomematic/client/rpc_proxy.py +629 -0
  55. aiohomematic/client/state_machine.py +324 -0
  56. aiohomematic/const.py +2207 -0
  57. aiohomematic/context.py +275 -0
  58. aiohomematic/converter.py +270 -0
  59. aiohomematic/decorators.py +390 -0
  60. aiohomematic/exceptions.py +185 -0
  61. aiohomematic/hmcli.py +997 -0
  62. aiohomematic/i18n.py +193 -0
  63. aiohomematic/interfaces/__init__.py +407 -0
  64. aiohomematic/interfaces/central.py +1067 -0
  65. aiohomematic/interfaces/client.py +1096 -0
  66. aiohomematic/interfaces/coordinators.py +63 -0
  67. aiohomematic/interfaces/model.py +1921 -0
  68. aiohomematic/interfaces/operations.py +217 -0
  69. aiohomematic/logging_context.py +134 -0
  70. aiohomematic/metrics/__init__.py +125 -0
  71. aiohomematic/metrics/_protocols.py +140 -0
  72. aiohomematic/metrics/aggregator.py +534 -0
  73. aiohomematic/metrics/dataclasses.py +489 -0
  74. aiohomematic/metrics/emitter.py +292 -0
  75. aiohomematic/metrics/events.py +183 -0
  76. aiohomematic/metrics/keys.py +300 -0
  77. aiohomematic/metrics/observer.py +563 -0
  78. aiohomematic/metrics/stats.py +172 -0
  79. aiohomematic/model/__init__.py +189 -0
  80. aiohomematic/model/availability.py +65 -0
  81. aiohomematic/model/calculated/__init__.py +89 -0
  82. aiohomematic/model/calculated/climate.py +276 -0
  83. aiohomematic/model/calculated/data_point.py +315 -0
  84. aiohomematic/model/calculated/field.py +147 -0
  85. aiohomematic/model/calculated/operating_voltage_level.py +286 -0
  86. aiohomematic/model/calculated/support.py +232 -0
  87. aiohomematic/model/custom/__init__.py +214 -0
  88. aiohomematic/model/custom/capabilities/__init__.py +67 -0
  89. aiohomematic/model/custom/capabilities/climate.py +41 -0
  90. aiohomematic/model/custom/capabilities/light.py +87 -0
  91. aiohomematic/model/custom/capabilities/lock.py +44 -0
  92. aiohomematic/model/custom/capabilities/siren.py +63 -0
  93. aiohomematic/model/custom/climate.py +1130 -0
  94. aiohomematic/model/custom/cover.py +722 -0
  95. aiohomematic/model/custom/data_point.py +360 -0
  96. aiohomematic/model/custom/definition.py +300 -0
  97. aiohomematic/model/custom/field.py +89 -0
  98. aiohomematic/model/custom/light.py +1174 -0
  99. aiohomematic/model/custom/lock.py +322 -0
  100. aiohomematic/model/custom/mixins.py +445 -0
  101. aiohomematic/model/custom/profile.py +945 -0
  102. aiohomematic/model/custom/registry.py +251 -0
  103. aiohomematic/model/custom/siren.py +462 -0
  104. aiohomematic/model/custom/switch.py +195 -0
  105. aiohomematic/model/custom/text_display.py +289 -0
  106. aiohomematic/model/custom/valve.py +78 -0
  107. aiohomematic/model/data_point.py +1416 -0
  108. aiohomematic/model/device.py +1840 -0
  109. aiohomematic/model/event.py +216 -0
  110. aiohomematic/model/generic/__init__.py +327 -0
  111. aiohomematic/model/generic/action.py +40 -0
  112. aiohomematic/model/generic/action_select.py +62 -0
  113. aiohomematic/model/generic/binary_sensor.py +30 -0
  114. aiohomematic/model/generic/button.py +31 -0
  115. aiohomematic/model/generic/data_point.py +177 -0
  116. aiohomematic/model/generic/dummy.py +150 -0
  117. aiohomematic/model/generic/number.py +76 -0
  118. aiohomematic/model/generic/select.py +56 -0
  119. aiohomematic/model/generic/sensor.py +76 -0
  120. aiohomematic/model/generic/switch.py +54 -0
  121. aiohomematic/model/generic/text.py +33 -0
  122. aiohomematic/model/hub/__init__.py +100 -0
  123. aiohomematic/model/hub/binary_sensor.py +24 -0
  124. aiohomematic/model/hub/button.py +28 -0
  125. aiohomematic/model/hub/connectivity.py +190 -0
  126. aiohomematic/model/hub/data_point.py +342 -0
  127. aiohomematic/model/hub/hub.py +864 -0
  128. aiohomematic/model/hub/inbox.py +135 -0
  129. aiohomematic/model/hub/install_mode.py +393 -0
  130. aiohomematic/model/hub/metrics.py +208 -0
  131. aiohomematic/model/hub/number.py +42 -0
  132. aiohomematic/model/hub/select.py +52 -0
  133. aiohomematic/model/hub/sensor.py +37 -0
  134. aiohomematic/model/hub/switch.py +43 -0
  135. aiohomematic/model/hub/text.py +30 -0
  136. aiohomematic/model/hub/update.py +221 -0
  137. aiohomematic/model/support.py +592 -0
  138. aiohomematic/model/update.py +140 -0
  139. aiohomematic/model/week_profile.py +1827 -0
  140. aiohomematic/property_decorators.py +719 -0
  141. aiohomematic/py.typed +0 -0
  142. aiohomematic/rega_scripts/accept_device_in_inbox.fn +51 -0
  143. aiohomematic/rega_scripts/create_backup_start.fn +28 -0
  144. aiohomematic/rega_scripts/create_backup_status.fn +89 -0
  145. aiohomematic/rega_scripts/fetch_all_device_data.fn +97 -0
  146. aiohomematic/rega_scripts/get_backend_info.fn +25 -0
  147. aiohomematic/rega_scripts/get_inbox_devices.fn +61 -0
  148. aiohomematic/rega_scripts/get_program_descriptions.fn +31 -0
  149. aiohomematic/rega_scripts/get_serial.fn +44 -0
  150. aiohomematic/rega_scripts/get_service_messages.fn +83 -0
  151. aiohomematic/rega_scripts/get_system_update_info.fn +39 -0
  152. aiohomematic/rega_scripts/get_system_variable_descriptions.fn +31 -0
  153. aiohomematic/rega_scripts/set_program_state.fn +17 -0
  154. aiohomematic/rega_scripts/set_system_variable.fn +19 -0
  155. aiohomematic/rega_scripts/trigger_firmware_update.fn +67 -0
  156. aiohomematic/schemas.py +256 -0
  157. aiohomematic/store/__init__.py +55 -0
  158. aiohomematic/store/dynamic/__init__.py +43 -0
  159. aiohomematic/store/dynamic/command.py +250 -0
  160. aiohomematic/store/dynamic/data.py +175 -0
  161. aiohomematic/store/dynamic/details.py +187 -0
  162. aiohomematic/store/dynamic/ping_pong.py +416 -0
  163. aiohomematic/store/persistent/__init__.py +71 -0
  164. aiohomematic/store/persistent/base.py +285 -0
  165. aiohomematic/store/persistent/device.py +233 -0
  166. aiohomematic/store/persistent/incident.py +380 -0
  167. aiohomematic/store/persistent/paramset.py +241 -0
  168. aiohomematic/store/persistent/session.py +556 -0
  169. aiohomematic/store/serialization.py +150 -0
  170. aiohomematic/store/storage.py +689 -0
  171. aiohomematic/store/types.py +526 -0
  172. aiohomematic/store/visibility/__init__.py +40 -0
  173. aiohomematic/store/visibility/parser.py +141 -0
  174. aiohomematic/store/visibility/registry.py +722 -0
  175. aiohomematic/store/visibility/rules.py +307 -0
  176. aiohomematic/strings.json +237 -0
  177. aiohomematic/support.py +706 -0
  178. aiohomematic/tracing.py +236 -0
  179. aiohomematic/translations/de.json +237 -0
  180. aiohomematic/translations/en.json +237 -0
  181. aiohomematic/type_aliases.py +51 -0
  182. aiohomematic/validator.py +128 -0
  183. aiohomematic-2026.1.29.dist-info/METADATA +296 -0
  184. aiohomematic-2026.1.29.dist-info/RECORD +188 -0
  185. aiohomematic-2026.1.29.dist-info/WHEEL +5 -0
  186. aiohomematic-2026.1.29.dist-info/entry_points.txt +2 -0
  187. aiohomematic-2026.1.29.dist-info/licenses/LICENSE +21 -0
  188. aiohomematic-2026.1.29.dist-info/top_level.txt +1 -0
aiohomematic/py.typed ADDED
File without changes
@@ -0,0 +1,51 @@
1
+ !# name: accept_device_in_inbox.fn
2
+ !# param: "##device_address##"
3
+ !#
4
+ !# Accept a device from the CCU inbox by setting ReadyConfig to true.
5
+ !# The device address is passed as parameter.
6
+ !#
7
+ !# Params for session recorder
8
+ !#
9
+
10
+ string sDeviceAddress = "##device_address##";
11
+ boolean bSuccess = false;
12
+ boolean bFound = false;
13
+ string sError = "";
14
+
15
+ !# Find device by iterating through ID_DEVICES and matching address
16
+ object oDevices = dom.GetObject(ID_DEVICES);
17
+ if (oDevices) {
18
+ string sDevId;
19
+ foreach(sDevId, oDevices.EnumIDs()) {
20
+ object oDev = dom.GetObject(sDevId);
21
+ if (oDev) {
22
+ if (oDev.Address() == sDeviceAddress) {
23
+ bFound = true;
24
+ if (!oDev.ReadyConfig()) {
25
+ oDev.ReadyConfig(true);
26
+ bSuccess = oDev.ReadyConfig();
27
+ if (!bSuccess) {
28
+ sError = "Failed to set ReadyConfig";
29
+ }
30
+ } else {
31
+ sError = "Device already accepted";
32
+ bSuccess = true;
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ if (!bFound) {
40
+ sError = "Device not found";
41
+ }
42
+
43
+ Write('{"success":');
44
+ if (bSuccess) {
45
+ Write('true');
46
+ } else {
47
+ Write('false');
48
+ }
49
+ Write(',"error":"');
50
+ Write(sError);
51
+ Write('"}');
@@ -0,0 +1,28 @@
1
+ !# name: create_backup_start.fn
2
+ !#
3
+ !# This script starts a system backup in the background.
4
+ !# It returns immediately without waiting for completion.
5
+ !# Use create_backup_status.fn to check the backup status.
6
+ !#
7
+ !# The backup file is saved to /usr/local/tmp/last_backup.sbk
8
+ !# Works for OpenCCU.
9
+ !#
10
+
11
+ string sPid = "";
12
+
13
+ !# Remove any existing backup file and pid file
14
+ system.Exec("/bin/sh -c 'rm -f /usr/local/tmp/last_backup.sbk /usr/local/tmp/backup.pid'");
15
+
16
+ !# Start backup in background using nohup
17
+ !# Save the PID to a file for status checking
18
+ system.Exec("/bin/sh -c 'nohup /bin/sh -c \"/bin/createBackup.sh /usr/local/tmp/last_backup.sbk; rm -f /usr/local/tmp/backup.pid\" > /dev/null 2>&1 & echo $! > /usr/local/tmp/backup.pid'");
19
+
20
+ !# Verify the process was started
21
+ system.Exec("test -f /usr/local/tmp/backup.pid && cat /usr/local/tmp/backup.pid", &sPid);
22
+ sPid = sPid.Trim();
23
+
24
+ if (sPid != "") {
25
+ Write('{"success":true,"status":"started","pid":"' # sPid # '"}');
26
+ } else {
27
+ Write('{"success":false,"status":"failed","message":"Failed to start backup process"}');
28
+ }
@@ -0,0 +1,89 @@
1
+ !# name: create_backup_status.fn
2
+ !#
3
+ !# This script checks the status of a backup started by create_backup_start.fn.
4
+ !# Returns:
5
+ !# - "running": Backup process is still running
6
+ !# - "completed": Backup file exists and process has finished
7
+ !# - "failed": Process finished but no backup file exists
8
+ !# - "idle": No backup process started (no pid file)
9
+ !#
10
+
11
+ string sResult = "";
12
+ string sStatus = "idle";
13
+ string sPid = "";
14
+ string sSize = "";
15
+ string sHostname = "";
16
+ string sVersion = "";
17
+ string sFilename = "";
18
+ string sDate = "";
19
+
20
+ boolean bProcessRunning = false;
21
+ boolean bFileExists = false;
22
+ boolean bPidFileExists = false;
23
+ boolean bBackupComplete = false;
24
+
25
+ !# Check if pid file exists
26
+ sResult = "";
27
+ system.Exec("test -f /usr/local/tmp/backup.pid && echo 'YES' || echo 'NO'", &sResult);
28
+ if (sResult.Trim() == "YES") {
29
+ bPidFileExists = true;
30
+
31
+ !# Read the PID
32
+ sResult = "";
33
+ system.Exec("cat /usr/local/tmp/backup.pid", &sResult);
34
+ sPid = sResult.Trim();
35
+
36
+ !# Check if process is still running
37
+ sResult = "";
38
+ system.Exec("/bin/sh -c 'ps -o pid | grep " # sPid # " > /dev/null 2>&1 && echo YES || echo NO'", &sResult);
39
+ if (sResult.Trim() == "YES") {
40
+ bProcessRunning = true;
41
+ }
42
+ }
43
+
44
+ !# Check if backup file exists
45
+ sResult = "";
46
+ system.Exec("test -f /usr/local/tmp/last_backup.sbk && echo 'YES' || echo 'NO'", &sResult);
47
+ if (sResult.Trim() == "YES") {
48
+ bFileExists = true;
49
+ }
50
+
51
+ !# Determine status
52
+ if (bProcessRunning) {
53
+ sStatus = "running";
54
+ } else {
55
+ if (bFileExists) {
56
+ sStatus = "completed";
57
+ bBackupComplete = true;
58
+ !# Clean up pid file
59
+ system.Exec("rm -f /usr/local/tmp/backup.pid &");
60
+ } elseif (bPidFileExists) {
61
+ sStatus = "failed";
62
+ !# Clean up pid file
63
+ system.Exec("rm -f /usr/local/tmp/backup.pid &");
64
+ } else {
65
+ sStatus = "idle";
66
+ }
67
+ }
68
+
69
+ !# Build response
70
+ if (bBackupComplete) {
71
+ !# Get file size
72
+ system.Exec("stat -c %s /usr/local/tmp/last_backup.sbk 2>/dev/null", &sSize);
73
+ sSize = sSize.Trim();
74
+
75
+ !# Get backup filename with timestamp
76
+ system.Exec("hostname", &sHostname);
77
+ sHostname = sHostname.Trim();
78
+
79
+ system.Exec("cat /VERSION | grep VERSION= | cut -d= -f2", &sVersion);
80
+ sVersion = sVersion.Trim();
81
+
82
+ sDate = localtime.Format("%F-%H%M");
83
+
84
+ sFilename = sHostname # "-" # sVersion # "-" # sDate # ".sbk";
85
+
86
+ Write('{"status":"' # sStatus # '","file":"/usr/local/tmp/last_backup.sbk","filename":"' # sFilename # '","size":' # sSize # '}');
87
+ } else {
88
+ Write('{"status":"' # sStatus # '"}');
89
+ }
@@ -0,0 +1,97 @@
1
+ !# name: fetch_all_device_data.fn
2
+ !# param: "##interface##"
3
+ !#
4
+ !# This script fetches all device data required to initialize the entities without affecting the duty cycle.
5
+ !#
6
+ !# Original script: https://github.com/ioBroker/ioBroker.hm-rega/blob/master/regascripts/datapoints.fn
7
+ !# datapoints.fn 1.9
8
+ !# 3'2013-9'2014 hobbyquaker https://github.com/hobbyquaker
9
+ !#
10
+ !# Dieses Homematic-Script gibt eine Liste aller Datenpunkte, die zur Laufzeit einen validen Zeitstempel haben, als JSON String aus.
11
+ !#
12
+ !# modified by: SukramJ https://github.com/SukramJ && Baxxy13 https://github.com/Baxxy13
13
+ !# v2.2 - 09/2023
14
+ !#
15
+ !# Das Interface wird durch die Integration an 'sUse_Interface' übergeben.
16
+ !# Nutzbare Interfaces: BidCos-RF, BidCos-Wired, HmIP-RF, VirtualDevices
17
+ !# Zum Testen direkt auf der Homematic-Zentrale muss das Interface wie folgt eingetragen werden: sUse_Interface = "HmIP-RF";
18
+ !#
19
+ !# Params for session recorder
20
+ !#
21
+
22
+ string sUse_Interface = "##interface##";
23
+ string sDevId;
24
+ string sChnId;
25
+ string sDPId;
26
+ var vDPValue;
27
+ boolean bDPFirst = true;
28
+ object oInterface = interfaces.Get(sUse_Interface);
29
+
30
+ Write('{');
31
+ if (oInterface) {
32
+ integer iInterface_ID = interfaces.Get(sUse_Interface).ID();
33
+ string sAllDevices = dom.GetObject(ID_DEVICES).EnumUsedIDs();
34
+ foreach (sDevId, sAllDevices) {
35
+ object oDevice = dom.GetObject(sDevId);
36
+ if ((oDevice) && (oDevice.ReadyConfig()) && (oDevice.Interface() == iInterface_ID)) {
37
+ foreach (sChnId, oDevice.Channels()) {
38
+ object oChannel = dom.GetObject(sChnId);
39
+ if (oChannel) {
40
+ var oDPs = oChannel.DPs();
41
+ if (oDPs) {
42
+ foreach(sDPId, oDPs.EnumUsedIDs()) {
43
+ object oDP = dom.GetObject(sDPId);
44
+ if (oDP && oDP.Timestamp()) {
45
+ if (oDP.TypeName() != "VARDP") {
46
+ integer sValueType = oDP.ValueType();
47
+ boolean bHasValue = false;
48
+ string sValue;
49
+ string sID = oDP.Name().UriEncode();
50
+ if (sValueType == 20) {
51
+ sValue = oDP.Value().UriEncode();
52
+ bHasValue = true;
53
+ } else {
54
+ vDPValue = oDP.Value();
55
+ if (sValueType == 2) {
56
+ if (vDPValue) {
57
+ sValue = "true";
58
+ } else {
59
+ sValue = "false";
60
+ }
61
+ bHasValue = true;
62
+ } else {
63
+ if (vDPValue == "") {
64
+ sValue = "0";
65
+ } else {
66
+ sValue = vDPValue;
67
+ }
68
+ bHasValue = true;
69
+ }
70
+ }
71
+ if (bHasValue) {
72
+ if (bDPFirst) {
73
+ bDPFirst = false;
74
+ } else {
75
+ WriteLine(',');
76
+ }
77
+ Write('"');
78
+ Write(sID);
79
+ Write('":');
80
+ if (sValueType == 20) {
81
+ Write('"');
82
+ Write(sValue);
83
+ Write('"');
84
+ } else {
85
+ Write(sValue);
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ Write('}');
@@ -0,0 +1,25 @@
1
+ !# name: get_backend_info.fn
2
+ !#
3
+ !# This script retrieves backend information and identifies the CCU type.
4
+ !# Product is normalized to CCU (CCU2/CCU3/debmatic) or OpenCCU
5
+ !#
6
+
7
+ string sVersion = "";
8
+ string sProduct = "";
9
+ string sHostname = "";
10
+
11
+ system.Exec("grep VERSION= /VERSION | tr -d '[:space:]' | cut -d= -f2", &sVersion);
12
+ sVersion = sVersion.Trim();
13
+
14
+ system.Exec("grep PRODUCT= /VERSION | tr -d '[:space:]' | cut -d= -f2", &sProduct);
15
+ sProduct = sProduct.Trim();
16
+ if ((!sProduct.Contains("ccu")) && (!sProduct == "debmatic")) {
17
+ sProduct = "OpenCCU";
18
+ } else {
19
+ sProduct = "CCU";
20
+ }
21
+
22
+ system.Exec("hostname", &sHostname);
23
+ sHostname = sHostname.Trim();
24
+
25
+ Write('{"version":"' # sVersion # '","product":"' # sProduct # '","hostname":"' # sHostname # '"}');
@@ -0,0 +1,61 @@
1
+ !# name: get_inbox_devices.fn
2
+ !#
3
+ !# This script returns all devices in the CCU inbox (not yet configured).
4
+ !# These are newly paired devices that haven't been set up yet.
5
+ !#
6
+
7
+ string sDevId;
8
+ boolean bFirst = true;
9
+ string sName;
10
+ string sAddress;
11
+ string sType;
12
+ string sInterface;
13
+
14
+ Write('[');
15
+
16
+ object oDevices = dom.GetObject(ID_DEVICES);
17
+ if (oDevices) {
18
+ foreach(sDevId, oDevices.EnumIDs()) {
19
+ object oDev = dom.GetObject(sDevId);
20
+ if (oDev) {
21
+ !# Check if device is not yet configured (in inbox)
22
+ if ((!oDev.ReadyConfig()) && (oDev.Name() != "Gateway")) {
23
+ if (bFirst) {
24
+ bFirst = false;
25
+ } else {
26
+ Write(',');
27
+ }
28
+
29
+ sAddress = oDev.Address();
30
+ if (!sAddress) {
31
+ sAddress = "";
32
+ }
33
+
34
+ sName = oDev.Name();
35
+ if (sName) {
36
+ sName = sName.UriEncode();
37
+ } else {
38
+ sName = "";
39
+ }
40
+
41
+ sType = oDev.HssType();
42
+ if (!sType) {
43
+ sType = "";
44
+ }
45
+
46
+ sInterface = oDev.Interface();
47
+ if (!sInterface) {
48
+ sInterface = "";
49
+ }
50
+
51
+ Write('{"id":"' # oDev.ID() # '",');
52
+ Write('"address":"' # sAddress # '",');
53
+ Write('"name":"' # sName # '",');
54
+ Write('"type":"' # sType # '",');
55
+ Write('"interface":"' # sInterface # '"}');
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ Write(']');
@@ -0,0 +1,31 @@
1
+ !# name: get_program_descriptions.fn
2
+ !#
3
+ !# Erstellt in Ergänzung zu https://github.com/eq-3/occu/blob/45b38865f6b60f16f825b75f0bdc8a9738831ee0/WebUI/www/api/methods/sysvar/getall.tcl
4
+ !# Erweitert das Script um "description"
5
+ !#
6
+
7
+ string id;
8
+ boolean dpFirst = true;
9
+ Write("[");
10
+ foreach(id, dom.GetObject(ID_PROGRAMS).EnumIDs()) {
11
+ object prg = dom.GetObject(id);
12
+ string description = "";
13
+ if (prg) {
14
+ ! use UriEncode() to ensure special characters " and \
15
+ ! and others are properly encoded using URI/URL percentage
16
+ ! encoding
17
+ description = prg.PrgInfo().UriEncode();
18
+
19
+ if (dpFirst) {
20
+ dpFirst = false;
21
+ } else {
22
+ WriteLine(',');
23
+ }
24
+
25
+ Write("{");
26
+ Write("\"id\": \"" # id # "\",");
27
+ Write("\"description\": \"" # description # "\"");
28
+ Write("}");
29
+ }
30
+ }
31
+ Write("]");
@@ -0,0 +1,44 @@
1
+ !# name: get_serial.fn
2
+ !#
3
+ !# Erstellt durch @baxxy13 2022-04-09
4
+ !#
5
+ !# Dieses Script liefert die Seriennummer des Funkmoduls in folgender Priorisierung zurück:
6
+ !# 1. /var/board_sgtin
7
+ !# 2. /var/board_serial
8
+ !# 3. /sys/module/plat_eq3ccu2/parameters/board_serial
9
+ !#
10
+ !# Dieses Script wird als Ersatz für JsonRPC CCU.getSerial verwendet.
11
+ !#
12
+
13
+ string serial;
14
+ boolean find = false;
15
+ string cmd_a = "/bin/sh -c 'cat /var/board_sgtin'";
16
+ string cmd_b = "/bin/sh -c 'cat /var/board_serial'";
17
+ string cmd_c = "/bin/sh -c 'cat /sys/module/plat_eq3ccu2/parameters/board_serial'";
18
+
19
+ !# Try uses /var/board_sgtin
20
+ system.Exec(cmd_a, &serial, &error);
21
+ if (serial) {
22
+ serial = serial.Trim();
23
+ find = true;
24
+ }
25
+ !# Try uses /var/board_serial
26
+ if (!find) {
27
+ system.Exec(cmd_b, &serial, &error);
28
+ if (serial) {
29
+ serial = serial.Trim();
30
+ find = true;
31
+ }
32
+ }
33
+ !# Try uses /sys/module/plat_eq3ccu2/parameters/board_serial
34
+ if (!find) {
35
+ system.Exec(cmd_c, &serial, &error);
36
+ if (serial) {
37
+ serial = serial.Trim();
38
+ }
39
+ }
40
+
41
+ if (!serial) {
42
+ serial = "unknown";
43
+ }
44
+ WriteLine('{"serial": "'# serial #'"}');
@@ -0,0 +1,83 @@
1
+ !# name: get_service_messages.fn
2
+ !#
3
+ !# Return all active service messages from the CCU.
4
+ !# Service messages include connectivity issues (UNREACH), configuration
5
+ !# pending, low battery warnings, and other device alerts.
6
+ !#
7
+ !# Note: Inbox devices are handled separately by get_inbox_devices.fn.
8
+ !#
9
+
10
+ string sAlarmId;
11
+ boolean bFirst = true;
12
+
13
+ Write('[');
14
+
15
+ object oServices = dom.GetObject(ID_SERVICES);
16
+ if (oServices) {
17
+ foreach(sAlarmId, oServices.EnumIDs()) {
18
+ object oAlarm = dom.GetObject(sAlarmId);
19
+ if (oAlarm && (oAlarm.AlState() == 1)) {
20
+ if (bFirst) {
21
+ bFirst = false;
22
+ } else {
23
+ Write(',');
24
+ }
25
+
26
+ string sRawName = oAlarm.Name();
27
+ string sName = "";
28
+ if (sRawName) {
29
+ sName = sRawName.UriEncode();
30
+ } else {
31
+ sRawName = "";
32
+ }
33
+
34
+ string sTimestamp = "";
35
+ time tTime = oAlarm.AlOccurrenceTime();
36
+ if (tTime) {
37
+ sTimestamp = tTime.ToString();
38
+ }
39
+
40
+ integer iType = oAlarm.AlType();
41
+ string sAddress = "";
42
+ string sDeviceName = "";
43
+
44
+ !# Extract address from alarm name (format: "AL-ADDRESS:X.PARAM")
45
+ if (sRawName.Find("AL-") == 0) {
46
+ string sTmp = sRawName.Substr(3);
47
+ integer iColon = sTmp.Find(":");
48
+ if (iColon > 0) {
49
+ sAddress = sTmp.Substr(0, iColon);
50
+ }
51
+ }
52
+
53
+ !# Get device name from trigger data point channel
54
+ integer iTriggerDP = oAlarm.AlTriggerDP();
55
+ if (iTriggerDP) {
56
+ object oTrigger = dom.GetObject(iTriggerDP);
57
+ if (oTrigger) {
58
+ object oChn = oTrigger.Channel();
59
+ if (oChn) {
60
+ if (sAddress == "") {
61
+ sAddress = oChn.Address();
62
+ }
63
+ sDeviceName = oChn.Name();
64
+ if (sDeviceName) {
65
+ sDeviceName = sDeviceName.UriEncode();
66
+ } else {
67
+ sDeviceName = "";
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ Write('{"id":"' # oAlarm.ID() # '",');
74
+ Write('"name":"' # sName # '",');
75
+ Write('"timestamp":"' # sTimestamp # '",');
76
+ Write('"type":' # iType # ',');
77
+ Write('"address":"' # sAddress # '",');
78
+ Write('"device_name":"' # sDeviceName # '"}');
79
+ }
80
+ }
81
+ }
82
+
83
+ Write(']');
@@ -0,0 +1,39 @@
1
+ !# name: get_system_update_info.fn
2
+ !#
3
+ !# This script checks if a firmware update is available.
4
+ !# Only supported on OpenCCU (uses checkFirmwareUpdate.sh).
5
+ !#
6
+
7
+ string sFwCurrent = "";
8
+ string sFwAvailable = "";
9
+ string sResult = "";
10
+ boolean bUpdateAvailable = false;
11
+ boolean bCheckScriptAvailable = false;
12
+ integer iPos;
13
+ integer iExitCode;
14
+
15
+ !# Get current firmware version from /VERSION file
16
+ system.Exec("grep VERSION= /VERSION | tr -d '[:space:]' | cut -d= -f2", &sFwCurrent);
17
+ sFwCurrent = sFwCurrent.Trim();
18
+
19
+ !# Check if checkFirmwareUpdate.sh is available and working
20
+ system.Exec("/bin/checkFirmwareUpdate.sh 2>/dev/null; echo \"EXIT_CODE=$?\"", &sResult);
21
+ sResult = sResult.Trim();
22
+ iPos = sResult.Find("EXIT_CODE=");
23
+ iExitCode = (sResult.Substr(iPos + 10, sResult.Length())).ToInteger();
24
+
25
+ !# Check Exit codes: 0 = no update, 1 = update available, > 4 = error or script not available
26
+ if (iExitCode < 5) {
27
+ bCheckScriptAvailable = true;
28
+ if (iExitCode == 1) {
29
+ bUpdateAvailable = true;
30
+ sResult = sResult.Replace("\n\n",";");
31
+ sResult = sResult.StrValueByIndex(";",1);
32
+ sResult = sResult.Replace(" ",";");
33
+ sFwAvailable = sResult.StrValueByIndex(";",3);
34
+ }
35
+ }
36
+ Write('{"current_firmware":"'# sFwCurrent #'",');
37
+ Write('"available_firmware":"'# sFwAvailable #'",');
38
+ Write('"update_available":'# bUpdateAvailable #',');
39
+ Write('"check_script_available":'# bCheckScriptAvailable #'}');
@@ -0,0 +1,31 @@
1
+ !# name: get_system_variable_descriptions.fn
2
+ !#
3
+ !# Erstellt in Ergänzung zu https://github.com/eq-3/occu/blob/45b38865f6b60f16f825b75f0bdc8a9738831ee0/WebUI/www/api/methods/sysvar/getall.tcl
4
+ !# Erweitert das Script um "description"
5
+ !#
6
+
7
+ string id;
8
+ boolean dpFirst = true;
9
+ Write("[");
10
+ foreach(id, dom.GetObject(ID_SYSTEM_VARIABLES).EnumIDs()) {
11
+ object sv = dom.GetObject(id);
12
+ string description = "";
13
+ if (sv) {
14
+ ! use UriEncode() to ensure special characters " and \
15
+ ! and others are properly encoded using URI/URL percentage
16
+ ! encoding
17
+ description = sv.DPInfo().UriEncode();
18
+
19
+ if (dpFirst) {
20
+ dpFirst = false;
21
+ } else {
22
+ WriteLine(',');
23
+ }
24
+
25
+ Write("{");
26
+ Write("\"id\": \"" # id # "\",");
27
+ Write("\"description\": \"" # description # "\"");
28
+ Write("}");
29
+ }
30
+ }
31
+ Write("]");
@@ -0,0 +1,17 @@
1
+ !# name: set_program_state.fn
2
+ !# param: "##id##"
3
+ !# param: "##state##"
4
+ !#
5
+ !# Dieses Script setzt den Zustand eines Programmes auf der CCU.
6
+ !#
7
+ !# Params for session recorder
8
+ !#
9
+
10
+ string p_id = "##id##";
11
+ integer p_state = ##state##;
12
+
13
+ object program = dom.GetObject(ID_PROGRAMS).Get(p_id);
14
+ if (program) {
15
+ program.Active(p_state);
16
+ Write(program.Active())
17
+ }
@@ -0,0 +1,19 @@
1
+ !# name: set_system_variable.fn
2
+ !# param: "##name##"
3
+ !# param: "##value##"
4
+ !#
5
+ !# Erstellt durch @baxxy13 2022-04-11
6
+ !#
7
+ !# Dieses Script schreibt eine Systemvariable vom Typ Zeichenkette.
8
+ !#
9
+ !# Params for session recorder
10
+ !#
11
+
12
+ string sv_name = "##name##";
13
+ string sv_value = "##value##";
14
+ object target_sv = dom.GetObject(ID_SYSTEM_VARIABLES).Get(sv_name);
15
+ if (target_sv) {
16
+ if (target_sv.ValueTypeStr() == "String") {
17
+ Write(target_sv.State(sv_value));
18
+ }
19
+ }