aiohomematic 2025.8.6__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.
Potentially problematic release.
This version of aiohomematic might be problematic. Click here for more details.
- aiohomematic/__init__.py +47 -0
- aiohomematic/async_support.py +146 -0
- aiohomematic/caches/__init__.py +10 -0
- aiohomematic/caches/dynamic.py +554 -0
- aiohomematic/caches/persistent.py +459 -0
- aiohomematic/caches/visibility.py +774 -0
- aiohomematic/central/__init__.py +2034 -0
- aiohomematic/central/decorators.py +110 -0
- aiohomematic/central/xml_rpc_server.py +267 -0
- aiohomematic/client/__init__.py +1746 -0
- aiohomematic/client/json_rpc.py +1193 -0
- aiohomematic/client/xml_rpc.py +222 -0
- aiohomematic/const.py +795 -0
- aiohomematic/context.py +8 -0
- aiohomematic/converter.py +82 -0
- aiohomematic/decorators.py +188 -0
- aiohomematic/exceptions.py +145 -0
- aiohomematic/hmcli.py +159 -0
- aiohomematic/model/__init__.py +137 -0
- aiohomematic/model/calculated/__init__.py +65 -0
- aiohomematic/model/calculated/climate.py +230 -0
- aiohomematic/model/calculated/data_point.py +319 -0
- aiohomematic/model/calculated/operating_voltage_level.py +311 -0
- aiohomematic/model/calculated/support.py +174 -0
- aiohomematic/model/custom/__init__.py +175 -0
- aiohomematic/model/custom/climate.py +1334 -0
- aiohomematic/model/custom/const.py +146 -0
- aiohomematic/model/custom/cover.py +741 -0
- aiohomematic/model/custom/data_point.py +318 -0
- aiohomematic/model/custom/definition.py +861 -0
- aiohomematic/model/custom/light.py +1092 -0
- aiohomematic/model/custom/lock.py +389 -0
- aiohomematic/model/custom/siren.py +268 -0
- aiohomematic/model/custom/support.py +40 -0
- aiohomematic/model/custom/switch.py +172 -0
- aiohomematic/model/custom/valve.py +112 -0
- aiohomematic/model/data_point.py +1109 -0
- aiohomematic/model/decorators.py +173 -0
- aiohomematic/model/device.py +1347 -0
- aiohomematic/model/event.py +210 -0
- aiohomematic/model/generic/__init__.py +211 -0
- aiohomematic/model/generic/action.py +32 -0
- aiohomematic/model/generic/binary_sensor.py +28 -0
- aiohomematic/model/generic/button.py +25 -0
- aiohomematic/model/generic/data_point.py +162 -0
- aiohomematic/model/generic/number.py +73 -0
- aiohomematic/model/generic/select.py +36 -0
- aiohomematic/model/generic/sensor.py +72 -0
- aiohomematic/model/generic/switch.py +52 -0
- aiohomematic/model/generic/text.py +27 -0
- aiohomematic/model/hub/__init__.py +334 -0
- aiohomematic/model/hub/binary_sensor.py +22 -0
- aiohomematic/model/hub/button.py +26 -0
- aiohomematic/model/hub/data_point.py +332 -0
- aiohomematic/model/hub/number.py +37 -0
- aiohomematic/model/hub/select.py +47 -0
- aiohomematic/model/hub/sensor.py +35 -0
- aiohomematic/model/hub/switch.py +42 -0
- aiohomematic/model/hub/text.py +28 -0
- aiohomematic/model/support.py +599 -0
- aiohomematic/model/update.py +136 -0
- aiohomematic/py.typed +0 -0
- aiohomematic/rega_scripts/fetch_all_device_data.fn +75 -0
- aiohomematic/rega_scripts/get_program_descriptions.fn +30 -0
- aiohomematic/rega_scripts/get_serial.fn +44 -0
- aiohomematic/rega_scripts/get_system_variable_descriptions.fn +30 -0
- aiohomematic/rega_scripts/set_program_state.fn +12 -0
- aiohomematic/rega_scripts/set_system_variable.fn +15 -0
- aiohomematic/support.py +482 -0
- aiohomematic/validator.py +65 -0
- aiohomematic-2025.8.6.dist-info/METADATA +69 -0
- aiohomematic-2025.8.6.dist-info/RECORD +77 -0
- aiohomematic-2025.8.6.dist-info/WHEEL +5 -0
- aiohomematic-2025.8.6.dist-info/licenses/LICENSE +21 -0
- aiohomematic-2025.8.6.dist-info/top_level.txt +2 -0
- aiohomematic_support/__init__.py +1 -0
- aiohomematic_support/client_local.py +349 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Module for data points implemented using the update category."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from functools import partial
|
|
8
|
+
from typing import Final
|
|
9
|
+
|
|
10
|
+
from aiohomematic.const import (
|
|
11
|
+
CALLBACK_TYPE,
|
|
12
|
+
DEFAULT_CUSTOM_ID,
|
|
13
|
+
HMIP_FIRMWARE_UPDATE_IN_PROGRESS_STATES,
|
|
14
|
+
HMIP_FIRMWARE_UPDATE_READY_STATES,
|
|
15
|
+
DataPointCategory,
|
|
16
|
+
Interface,
|
|
17
|
+
)
|
|
18
|
+
from aiohomematic.decorators import inspector
|
|
19
|
+
from aiohomematic.exceptions import AioHomematicException
|
|
20
|
+
from aiohomematic.model import device as hmd
|
|
21
|
+
from aiohomematic.model.data_point import CallbackDataPoint
|
|
22
|
+
from aiohomematic.model.decorators import config_property, state_property
|
|
23
|
+
from aiohomematic.model.support import DataPointPathData, PayloadMixin, generate_unique_id
|
|
24
|
+
|
|
25
|
+
__all__ = ["DpUpdate"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DpUpdate(CallbackDataPoint, PayloadMixin):
|
|
29
|
+
"""
|
|
30
|
+
Implementation of a update.
|
|
31
|
+
|
|
32
|
+
This is a default data point that gets automatically generated.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
__slots__ = ("_device",)
|
|
36
|
+
|
|
37
|
+
_category = DataPointCategory.UPDATE
|
|
38
|
+
|
|
39
|
+
def __init__(self, device: hmd.Device) -> None:
|
|
40
|
+
"""Init the callback data_point."""
|
|
41
|
+
PayloadMixin.__init__(self)
|
|
42
|
+
self._device: Final = device
|
|
43
|
+
super().__init__(
|
|
44
|
+
central=device.central,
|
|
45
|
+
unique_id=generate_unique_id(central=device.central, address=device.address, parameter="Update"),
|
|
46
|
+
)
|
|
47
|
+
self._set_modified_at(modified_at=datetime.now())
|
|
48
|
+
|
|
49
|
+
@state_property
|
|
50
|
+
def available(self) -> bool:
|
|
51
|
+
"""Return the availability of the device."""
|
|
52
|
+
return self._device.available
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def device(self) -> hmd.Device:
|
|
56
|
+
"""Return the device of the data_point."""
|
|
57
|
+
return self._device
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def full_name(self) -> str:
|
|
61
|
+
"""Return the full name of the data_point."""
|
|
62
|
+
return f"{self._device.name} Update"
|
|
63
|
+
|
|
64
|
+
@config_property
|
|
65
|
+
def name(self) -> str:
|
|
66
|
+
"""Return the name of the data_point."""
|
|
67
|
+
return "Update"
|
|
68
|
+
|
|
69
|
+
@state_property
|
|
70
|
+
def firmware(self) -> str | None:
|
|
71
|
+
"""Version installed and in use."""
|
|
72
|
+
return self._device.firmware
|
|
73
|
+
|
|
74
|
+
@state_property
|
|
75
|
+
def firmware_update_state(self) -> str | None:
|
|
76
|
+
"""Latest version available for install."""
|
|
77
|
+
return self._device.firmware_update_state
|
|
78
|
+
|
|
79
|
+
@state_property
|
|
80
|
+
def in_progress(self) -> bool:
|
|
81
|
+
"""Update installation progress."""
|
|
82
|
+
if self._device.interface == Interface.HMIP_RF:
|
|
83
|
+
return self._device.firmware_update_state in HMIP_FIRMWARE_UPDATE_IN_PROGRESS_STATES
|
|
84
|
+
return False
|
|
85
|
+
|
|
86
|
+
@state_property
|
|
87
|
+
def latest_firmware(self) -> str | None:
|
|
88
|
+
"""Latest firmware available for install."""
|
|
89
|
+
if self._device.available_firmware and (
|
|
90
|
+
(
|
|
91
|
+
self._device.interface == Interface.HMIP_RF
|
|
92
|
+
and self._device.firmware_update_state in HMIP_FIRMWARE_UPDATE_READY_STATES
|
|
93
|
+
)
|
|
94
|
+
or self._device.interface in (Interface.BIDCOS_RF, Interface.BIDCOS_WIRED)
|
|
95
|
+
):
|
|
96
|
+
return self._device.available_firmware
|
|
97
|
+
return self._device.firmware
|
|
98
|
+
|
|
99
|
+
def _get_path_data(self) -> DataPointPathData:
|
|
100
|
+
"""Return the path data of the data_point."""
|
|
101
|
+
return DataPointPathData(
|
|
102
|
+
interface=None,
|
|
103
|
+
address=self._device.address,
|
|
104
|
+
channel_no=None,
|
|
105
|
+
kind=DataPointCategory.UPDATE,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
def register_data_point_updated_callback(self, cb: Callable, custom_id: str) -> CALLBACK_TYPE:
|
|
109
|
+
"""Register update callback."""
|
|
110
|
+
if custom_id != DEFAULT_CUSTOM_ID:
|
|
111
|
+
if self._custom_id is not None:
|
|
112
|
+
raise AioHomematicException(
|
|
113
|
+
f"REGISTER_UPDATE_CALLBACK failed: hm_data_point: {self.full_name} is already registered by {self._custom_id}"
|
|
114
|
+
)
|
|
115
|
+
self._custom_id = custom_id
|
|
116
|
+
|
|
117
|
+
if self._device.register_firmware_update_callback(cb) is not None:
|
|
118
|
+
return partial(self._unregister_data_point_updated_callback, cb=cb, custom_id=custom_id)
|
|
119
|
+
return None
|
|
120
|
+
|
|
121
|
+
def _unregister_data_point_updated_callback(self, cb: Callable, custom_id: str) -> None:
|
|
122
|
+
"""Unregister update callback."""
|
|
123
|
+
if custom_id is not None:
|
|
124
|
+
self._custom_id = None
|
|
125
|
+
self._device.unregister_firmware_update_callback(cb)
|
|
126
|
+
|
|
127
|
+
@inspector()
|
|
128
|
+
async def update_firmware(self, refresh_after_update_intervals: tuple[int, ...]) -> bool:
|
|
129
|
+
"""Turn the update on."""
|
|
130
|
+
return await self._device.update_firmware(refresh_after_update_intervals=refresh_after_update_intervals)
|
|
131
|
+
|
|
132
|
+
@inspector()
|
|
133
|
+
async def refresh_firmware_data(self) -> None:
|
|
134
|
+
"""Refresh device firmware data."""
|
|
135
|
+
await self._device.central.refresh_firmware_data(device_address=self._device.address)
|
|
136
|
+
self._set_modified_at(modified_at=datetime.now())
|
aiohomematic/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
!# fetch_all_device_data.fn v2.2
|
|
2
|
+
!# This script fetches all device data required to initialize the entities without affecting the duty cycle.
|
|
3
|
+
!#
|
|
4
|
+
!# Original script: https://github.com/ioBroker/ioBroker.hm-rega/blob/master/regascripts/datapoints.fn
|
|
5
|
+
!# datapoints.fn 1.9
|
|
6
|
+
!# 3'2013-9'2014 hobbyquaker https://github.com/hobbyquaker
|
|
7
|
+
!#
|
|
8
|
+
!# Dieses Homematic-Script gibt eine Liste aller Datenpunkte, die zur Laufzeit einen validen Zeitstempel haben, als JSON String aus.
|
|
9
|
+
!#
|
|
10
|
+
!# modified by: SukramJ https://github.com/SukramJ && Baxxy13 https://github.com/Baxxy13
|
|
11
|
+
!# v2.2 - 09/2023
|
|
12
|
+
!#
|
|
13
|
+
!# Das Interface wird durch die Integration an 'sUse_Interface' übergeben.
|
|
14
|
+
!# Nutzbare Interfaces: BidCos-RF, BidCos-Wired, HmIP-RF, VirtualDevices
|
|
15
|
+
!# Zum Testen direkt auf der Homematic-Zentrale muss das Interface wie folgt eingetragen werden: sUse_Interface = "HmIP-RF";
|
|
16
|
+
|
|
17
|
+
string sUse_Interface = "##interface##";
|
|
18
|
+
string sDevId;
|
|
19
|
+
string sChnId;
|
|
20
|
+
string sDPId;
|
|
21
|
+
string sDPId;
|
|
22
|
+
var vDPValue;
|
|
23
|
+
boolean bDPFirst = true;
|
|
24
|
+
object oInterface = interfaces.Get(sUse_Interface);
|
|
25
|
+
|
|
26
|
+
Write('{');
|
|
27
|
+
if (oInterface) {
|
|
28
|
+
integer iInterface_ID = interfaces.Get(sUse_Interface).ID();
|
|
29
|
+
string sAllDevices = dom.GetObject(ID_DEVICES).EnumUsedIDs();
|
|
30
|
+
foreach (sDevId, sAllDevices) {
|
|
31
|
+
object oDevice = dom.GetObject(sDevId);
|
|
32
|
+
if ((oDevice) && (oDevice.ReadyConfig()) && (oDevice.Interface() == iInterface_ID)) {
|
|
33
|
+
foreach (sChnId, oDevice.Channels()) {
|
|
34
|
+
object oChannel = dom.GetObject(sChnId);
|
|
35
|
+
foreach(sDPId, oChannel.DPs().EnumUsedIDs()) {
|
|
36
|
+
object oDP = dom.GetObject(sDPId);
|
|
37
|
+
if (oDP && oDP.Timestamp()) {
|
|
38
|
+
if (oDP.TypeName() != "VARDP") {
|
|
39
|
+
if (bDPFirst) {
|
|
40
|
+
bDPFirst = false;
|
|
41
|
+
} else {
|
|
42
|
+
WriteLine(',');
|
|
43
|
+
}
|
|
44
|
+
integer sValueType = oDP.ValueType();
|
|
45
|
+
Write('"');
|
|
46
|
+
WriteURL(oDP.Name());
|
|
47
|
+
Write('":');
|
|
48
|
+
if (sValueType == 20) {
|
|
49
|
+
Write('"');
|
|
50
|
+
WriteURL(oDP.Value());
|
|
51
|
+
Write('"');
|
|
52
|
+
} else {
|
|
53
|
+
vDPValue = oDP.Value();
|
|
54
|
+
if (sValueType == 2) {
|
|
55
|
+
if (vDPValue) {
|
|
56
|
+
Write("true");
|
|
57
|
+
} else {
|
|
58
|
+
Write("false");
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if (vDPValue == "") {
|
|
62
|
+
Write("0");
|
|
63
|
+
} else {
|
|
64
|
+
Write(vDPValue);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
Write('}');
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
!# get_program_descriptions.fn
|
|
2
|
+
!# Erstellt in Ergänzung zu https://github.com/eq-3/occu/blob/45b38865f6b60f16f825b75f0bdc8a9738831ee0/WebUI/www/api/methods/sysvar/getall.tcl
|
|
3
|
+
!# Erweitert das Script um "description"
|
|
4
|
+
!#
|
|
5
|
+
|
|
6
|
+
string id;
|
|
7
|
+
boolean dpFirst = true;
|
|
8
|
+
Write("[");
|
|
9
|
+
foreach(id, dom.GetObject(ID_PROGRAMS).EnumIDs()) {
|
|
10
|
+
object prg = dom.GetObject(id);
|
|
11
|
+
string description = "";
|
|
12
|
+
if (prg) {
|
|
13
|
+
! use UriEncode() to ensure special characters " and \
|
|
14
|
+
! and others are properly encoded using URI/URL percentage
|
|
15
|
+
! encoding
|
|
16
|
+
description = prg.PrgInfo().UriEncode();
|
|
17
|
+
|
|
18
|
+
if (dpFirst) {
|
|
19
|
+
dpFirst = false;
|
|
20
|
+
} else {
|
|
21
|
+
WriteLine(',');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Write("{");
|
|
25
|
+
Write("\"id\": \"" # id # "\",");
|
|
26
|
+
Write("\"description\": \"" # description # "\"");
|
|
27
|
+
Write("}");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
Write("]");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
!# get_serial
|
|
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,30 @@
|
|
|
1
|
+
!# get_system_variable_descriptions.fn
|
|
2
|
+
!# Erstellt in Ergänzung zu https://github.com/eq-3/occu/blob/45b38865f6b60f16f825b75f0bdc8a9738831ee0/WebUI/www/api/methods/sysvar/getall.tcl
|
|
3
|
+
!# Erweitert das Script um "description"
|
|
4
|
+
!#
|
|
5
|
+
|
|
6
|
+
string id;
|
|
7
|
+
boolean dpFirst = true;
|
|
8
|
+
Write("[");
|
|
9
|
+
foreach(id, dom.GetObject(ID_SYSTEM_VARIABLES).EnumIDs()) {
|
|
10
|
+
object sv = dom.GetObject(id);
|
|
11
|
+
string description = "";
|
|
12
|
+
if (sv) {
|
|
13
|
+
! use UriEncode() to ensure special characters " and \
|
|
14
|
+
! and others are properly encoded using URI/URL percentage
|
|
15
|
+
! encoding
|
|
16
|
+
description = sv.DPInfo().UriEncode();
|
|
17
|
+
|
|
18
|
+
if (dpFirst) {
|
|
19
|
+
dpFirst = false;
|
|
20
|
+
} else {
|
|
21
|
+
WriteLine(',');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Write("{");
|
|
25
|
+
Write("\"id\": \"" # id # "\",");
|
|
26
|
+
Write("\"description\": \"" # description # "\"");
|
|
27
|
+
Write("}");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
Write("]");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
!# set_program_state.fn
|
|
2
|
+
!#
|
|
3
|
+
!# Dieses Script setzt den Zustand eines Programmes auf der CCU.
|
|
4
|
+
!#
|
|
5
|
+
string p_id = "##id##";
|
|
6
|
+
integer p_state = ##state##;
|
|
7
|
+
|
|
8
|
+
object program = dom.GetObject(ID_PROGRAMS).Get(p_id);
|
|
9
|
+
if (program) {
|
|
10
|
+
program.Active(p_state);
|
|
11
|
+
Write(program.Active())
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
!# set_system_variable
|
|
2
|
+
!#
|
|
3
|
+
!# Erstellt durch @baxxy13 2022-04-11
|
|
4
|
+
!#
|
|
5
|
+
!# Dieses Script schreibt eine Systemvariable vom Typ Zeichenkette.
|
|
6
|
+
!#
|
|
7
|
+
|
|
8
|
+
string sv_name = "##name##";
|
|
9
|
+
string sv_value = "##value##";
|
|
10
|
+
object target_sv = dom.GetObject(ID_SYSTEM_VARIABLES).Get(sv_name);
|
|
11
|
+
if (target_sv) {
|
|
12
|
+
if (target_sv.ValueTypeStr() == "String") {
|
|
13
|
+
Write(target_sv.State(sv_value));
|
|
14
|
+
}
|
|
15
|
+
}
|