aiohomematic 2025.8.8__tar.gz → 2025.8.10__tar.gz
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.
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/LICENSE +1 -1
- aiohomematic-2025.8.10/PKG-INFO +124 -0
- aiohomematic-2025.8.10/README.md +96 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/__init__.py +15 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/async_support.py +15 -2
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/caches/__init__.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/caches/dynamic.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/caches/persistent.py +29 -22
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/caches/visibility.py +277 -252
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/central/__init__.py +69 -49
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/central/decorators.py +60 -15
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/central/xml_rpc_server.py +15 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/client/__init__.py +2 -0
- aiohomematic-2025.8.10/aiohomematic/client/_rpc_errors.py +81 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/client/json_rpc.py +68 -19
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/client/xml_rpc.py +15 -8
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/const.py +145 -77
- aiohomematic-2025.8.10/aiohomematic/context.py +18 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/converter.py +27 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/decorators.py +88 -19
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/exceptions.py +19 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/hmcli.py +13 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/__init__.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/calculated/__init__.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/calculated/climate.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/calculated/data_point.py +7 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/calculated/operating_voltage_level.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/calculated/support.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/__init__.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/climate.py +3 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/const.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/cover.py +30 -2
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/data_point.py +6 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/definition.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/light.py +18 -10
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/lock.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/siren.py +5 -2
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/support.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/switch.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/custom/valve.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/data_point.py +30 -3
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/decorators.py +29 -8
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/device.py +9 -5
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/event.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/__init__.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/action.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/binary_sensor.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/button.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/data_point.py +4 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/number.py +4 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/select.py +4 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/sensor.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/switch.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/generic/text.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/__init__.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/binary_sensor.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/button.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/data_point.py +6 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/number.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/select.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/sensor.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/switch.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/hub/text.py +2 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/support.py +26 -1
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/model/update.py +6 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/support.py +175 -5
- aiohomematic-2025.8.10/aiohomematic/validator.py +112 -0
- aiohomematic-2025.8.10/aiohomematic.egg-info/PKG-INFO +124 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic.egg-info/SOURCES.txt +1 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_central_pydevccu.py +7 -7
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_device.py +4 -3
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_siren.py +4 -2
- aiohomematic-2025.8.8/PKG-INFO +0 -69
- aiohomematic-2025.8.8/README.md +0 -41
- aiohomematic-2025.8.8/aiohomematic/context.py +0 -8
- aiohomematic-2025.8.8/aiohomematic/validator.py +0 -65
- aiohomematic-2025.8.8/aiohomematic.egg-info/PKG-INFO +0 -69
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/py.typed +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/rega_scripts/fetch_all_device_data.fn +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/rega_scripts/get_program_descriptions.fn +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/rega_scripts/get_serial.fn +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/rega_scripts/get_system_variable_descriptions.fn +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/rega_scripts/set_program_state.fn +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic/rega_scripts/set_system_variable.fn +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic.egg-info/dependency_links.txt +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic.egg-info/requires.txt +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic.egg-info/top_level.txt +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic_support/__init__.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/aiohomematic_support/client_local.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/pyproject.toml +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/setup.cfg +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_action.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_binary_sensor.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_button.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_calculated_support.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_central.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_climate.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_cover.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_decorator.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_entity.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_event.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_json_rpc.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_light.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_lock.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_number.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_select.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_sensor.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_support.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_switch.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_text.py +0 -0
- {aiohomematic-2025.8.8 → aiohomematic-2025.8.10}/tests/test_valve.py +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aiohomematic
|
|
3
|
+
Version: 2025.8.10
|
|
4
|
+
Summary: Homematic interface for Home Assistant running on Python 3.
|
|
5
|
+
Home-page: https://github.com/sukramj/aiohomematic
|
|
6
|
+
Author-email: SukramJ <sukramj@icloud.com>, Daniel Perna <danielperna84@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
Project-URL: Source Code, https://github.com/sukramj/aiohomematic
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/sukramj/aiohomematic/issues
|
|
10
|
+
Project-URL: Docs: Dev, https://github.com/sukramj/aiohomematic
|
|
11
|
+
Project-URL: Forum, https://github.com/sukramj/aiohomematic/discussions
|
|
12
|
+
Keywords: home,automation,homematic
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Home Automation
|
|
20
|
+
Requires-Python: >=3.13.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: aiohttp>=3.10.0
|
|
24
|
+
Requires-Dist: orjson>=3.10.0
|
|
25
|
+
Requires-Dist: python-slugify>=8.0.0
|
|
26
|
+
Requires-Dist: voluptuous>=0.14.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# AIO Homematic (hahomematic)
|
|
30
|
+
|
|
31
|
+
A lightweight Python 3 library that powers Home Assistant integrations for controlling and monitoring [HomeMatic](https://www.eq-3.com/products/homematic.html) and [HomematicIP](https://www.homematic-ip.com/en/start.html) devices. Some third‑party devices/gateways (e.g., Bosch, Intertechno) may be supported as well.
|
|
32
|
+
|
|
33
|
+
This project is the modern successor to [pyhomematic](https://github.com/danielperna84/pyhomematic), focusing on automatic entity creation, fewer manual device definitions, and faster startups.
|
|
34
|
+
|
|
35
|
+
## How it works
|
|
36
|
+
|
|
37
|
+
Unlike pyhomematic, which required manual device mappings, aiohomematic automatically creates entities for each relevant parameter on every device channel (unless blacklisted). To achieve this it:
|
|
38
|
+
|
|
39
|
+
- Fetches and caches device paramsets (VALUES) for fast successive startups.
|
|
40
|
+
- Provides hooks for custom entity classes where complex behavior is needed (e.g., thermostats, lights, covers, climate, locks, sirens).
|
|
41
|
+
- Includes helpers for robust operation, such as automatic reconnection after CCU restarts.
|
|
42
|
+
|
|
43
|
+
## Key features
|
|
44
|
+
|
|
45
|
+
- Automatic entity discovery from device/channel parameters.
|
|
46
|
+
- Extensible via custom entity classes for complex devices.
|
|
47
|
+
- Caching of paramsets to speed up restarts.
|
|
48
|
+
- Designed to integrate with Home Assistant.
|
|
49
|
+
|
|
50
|
+
## Quickstart for Home Assistant
|
|
51
|
+
|
|
52
|
+
Use the Home Assistant custom integration "Homematic(IP) Local", which is powered by aiohomematic.
|
|
53
|
+
|
|
54
|
+
1. Prerequisites
|
|
55
|
+
- Home Assistant 2024.6 or newer recommended.
|
|
56
|
+
- A CCU3, RaspberryMatic, or Homegear instance reachable from Home Assistant.
|
|
57
|
+
- For HomematicIP devices, ensure CCU firmware meets the minimum versions listed below.
|
|
58
|
+
2. Install the integration
|
|
59
|
+
- Add the custom repository and install: https://github.com/sukramj/homematicip_local
|
|
60
|
+
- Follow the installation guide: https://github.com/sukramj/homematicip_local/wiki/Installation
|
|
61
|
+
3. Configure via Home Assistant UI
|
|
62
|
+
- In Home Assistant: Settings → Devices & Services → Add Integration → search for "Homematic(IP) Local".
|
|
63
|
+
- Enter the CCU/Homegear host (IP or hostname). If you use HTTPS on the CCU, enable SSL and accept the certificate if self‑signed.
|
|
64
|
+
- Provide credentials if your CCU requires them.
|
|
65
|
+
- Choose which interfaces to enable (HM, HmIP, Virtual). Default ports are typically 2001 (HM), 2010 (HmIP), 9292 (Virtual).
|
|
66
|
+
4. Network callbacks
|
|
67
|
+
- The integration needs to receive XML‑RPC callbacks from the CCU. Make sure Home Assistant is reachable from the CCU (no NAT/firewall blocking). The default callback port is 43439; you can adjust it in advanced options.
|
|
68
|
+
5. Verify
|
|
69
|
+
- After setup, devices should appear under Devices & Services → Homematic(IP) Local. Discovery may take a few seconds after the first connection while paramsets are fetched and cached for faster restarts.
|
|
70
|
+
|
|
71
|
+
If you need to use aiohomematic directly in Python, see the Public API and example below.
|
|
72
|
+
|
|
73
|
+
## Requirements
|
|
74
|
+
|
|
75
|
+
Due to a bug in earlier CCU2/CCU3 firmware, aiohomematic requires at least the following versions when used with HomematicIP devices:
|
|
76
|
+
|
|
77
|
+
- CCU2: 2.53.27
|
|
78
|
+
- CCU3: 3.53.26
|
|
79
|
+
|
|
80
|
+
See details here: https://github.com/jens-maus/RaspberryMatic/issues/843. Other CCU‑like platforms using the buggy HmIPServer version are not supported.
|
|
81
|
+
|
|
82
|
+
## Public API and imports
|
|
83
|
+
|
|
84
|
+
- The public API of aiohomematic is explicitly defined via **all** in each module and subpackage.
|
|
85
|
+
- Backwards‑compatible imports should target these modules:
|
|
86
|
+
- aiohomematic.central: CentralUnit, CentralConfig and related schemas
|
|
87
|
+
- aiohomematic.client: Client, InterfaceConfig, create_client, get_client
|
|
88
|
+
- aiohomematic.model: device/data point abstractions (see subpackages for details)
|
|
89
|
+
- aiohomematic.exceptions: library exception types intended for consumers
|
|
90
|
+
- aiohomematic.const: constants and enums (stable subset; see module **all**)
|
|
91
|
+
- The top‑level package only exposes **version** to avoid import cycles and keep startup lean. Prefer importing from the specific submodules listed above.
|
|
92
|
+
|
|
93
|
+
Example:
|
|
94
|
+
|
|
95
|
+
from aiohomematic.central import CentralConfig
|
|
96
|
+
from aiohomematic import client as hmcl
|
|
97
|
+
|
|
98
|
+
cfg = CentralConfig(
|
|
99
|
+
central_id="ccu-main",
|
|
100
|
+
host="ccu.local",
|
|
101
|
+
username="admin",
|
|
102
|
+
password="secret",
|
|
103
|
+
default_callback_port=43439,
|
|
104
|
+
interface_configs={hmcl.InterfaceConfig(interface=hmcl.Interface.HMIP, port=2010, enabled=True)},
|
|
105
|
+
)
|
|
106
|
+
central = cfg.create_central()
|
|
107
|
+
|
|
108
|
+
## Useful links
|
|
109
|
+
|
|
110
|
+
- Changelog: [see](changelog.md) for release history and latest changes.
|
|
111
|
+
- Definition of calculated data points: [see](docs/calculated_data_points.md)
|
|
112
|
+
- Homematic(IP) Local integration: https://github.com/sukramj/homematicip_local
|
|
113
|
+
- Input select helper: [see](docs/input_select_helper.md) for an overview of how to use the input select helper.
|
|
114
|
+
- Troubleshooting with Home Assistant: [see](docs/homeassistant_troubleshooting.md) for common issues and how to debug them.
|
|
115
|
+
- Unignore mechanism: [see](docs/unignore.md) for how to unignore devices that are ignored by default.
|
|
116
|
+
|
|
117
|
+
## Useful developer links
|
|
118
|
+
|
|
119
|
+
- Architecture overview: [see](docs/architecture.md) for an overview of the architecture of the library.
|
|
120
|
+
- Data flow: [see](docs/data_flow.md) for an overview of how data flows through the library.
|
|
121
|
+
- Extending the model: [see](docs/extension_points.md) for adding custom device profiles and calculated data points.
|
|
122
|
+
- Home Assistant lifecycle (discovery, updates, teardown): [see](docs/homeassistant_lifecycle.md) for details on how the integration works and how to debug issues.
|
|
123
|
+
- RSSI fix: [see](docs/rssi_fix.md) for how RSSI values are fixed for Home Assistant.
|
|
124
|
+
- Sequence diagrams: [see](docs/sequence_diagrams.md) for a sequence diagram of how the library works.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# AIO Homematic (hahomematic)
|
|
2
|
+
|
|
3
|
+
A lightweight Python 3 library that powers Home Assistant integrations for controlling and monitoring [HomeMatic](https://www.eq-3.com/products/homematic.html) and [HomematicIP](https://www.homematic-ip.com/en/start.html) devices. Some third‑party devices/gateways (e.g., Bosch, Intertechno) may be supported as well.
|
|
4
|
+
|
|
5
|
+
This project is the modern successor to [pyhomematic](https://github.com/danielperna84/pyhomematic), focusing on automatic entity creation, fewer manual device definitions, and faster startups.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
Unlike pyhomematic, which required manual device mappings, aiohomematic automatically creates entities for each relevant parameter on every device channel (unless blacklisted). To achieve this it:
|
|
10
|
+
|
|
11
|
+
- Fetches and caches device paramsets (VALUES) for fast successive startups.
|
|
12
|
+
- Provides hooks for custom entity classes where complex behavior is needed (e.g., thermostats, lights, covers, climate, locks, sirens).
|
|
13
|
+
- Includes helpers for robust operation, such as automatic reconnection after CCU restarts.
|
|
14
|
+
|
|
15
|
+
## Key features
|
|
16
|
+
|
|
17
|
+
- Automatic entity discovery from device/channel parameters.
|
|
18
|
+
- Extensible via custom entity classes for complex devices.
|
|
19
|
+
- Caching of paramsets to speed up restarts.
|
|
20
|
+
- Designed to integrate with Home Assistant.
|
|
21
|
+
|
|
22
|
+
## Quickstart for Home Assistant
|
|
23
|
+
|
|
24
|
+
Use the Home Assistant custom integration "Homematic(IP) Local", which is powered by aiohomematic.
|
|
25
|
+
|
|
26
|
+
1. Prerequisites
|
|
27
|
+
- Home Assistant 2024.6 or newer recommended.
|
|
28
|
+
- A CCU3, RaspberryMatic, or Homegear instance reachable from Home Assistant.
|
|
29
|
+
- For HomematicIP devices, ensure CCU firmware meets the minimum versions listed below.
|
|
30
|
+
2. Install the integration
|
|
31
|
+
- Add the custom repository and install: https://github.com/sukramj/homematicip_local
|
|
32
|
+
- Follow the installation guide: https://github.com/sukramj/homematicip_local/wiki/Installation
|
|
33
|
+
3. Configure via Home Assistant UI
|
|
34
|
+
- In Home Assistant: Settings → Devices & Services → Add Integration → search for "Homematic(IP) Local".
|
|
35
|
+
- Enter the CCU/Homegear host (IP or hostname). If you use HTTPS on the CCU, enable SSL and accept the certificate if self‑signed.
|
|
36
|
+
- Provide credentials if your CCU requires them.
|
|
37
|
+
- Choose which interfaces to enable (HM, HmIP, Virtual). Default ports are typically 2001 (HM), 2010 (HmIP), 9292 (Virtual).
|
|
38
|
+
4. Network callbacks
|
|
39
|
+
- The integration needs to receive XML‑RPC callbacks from the CCU. Make sure Home Assistant is reachable from the CCU (no NAT/firewall blocking). The default callback port is 43439; you can adjust it in advanced options.
|
|
40
|
+
5. Verify
|
|
41
|
+
- After setup, devices should appear under Devices & Services → Homematic(IP) Local. Discovery may take a few seconds after the first connection while paramsets are fetched and cached for faster restarts.
|
|
42
|
+
|
|
43
|
+
If you need to use aiohomematic directly in Python, see the Public API and example below.
|
|
44
|
+
|
|
45
|
+
## Requirements
|
|
46
|
+
|
|
47
|
+
Due to a bug in earlier CCU2/CCU3 firmware, aiohomematic requires at least the following versions when used with HomematicIP devices:
|
|
48
|
+
|
|
49
|
+
- CCU2: 2.53.27
|
|
50
|
+
- CCU3: 3.53.26
|
|
51
|
+
|
|
52
|
+
See details here: https://github.com/jens-maus/RaspberryMatic/issues/843. Other CCU‑like platforms using the buggy HmIPServer version are not supported.
|
|
53
|
+
|
|
54
|
+
## Public API and imports
|
|
55
|
+
|
|
56
|
+
- The public API of aiohomematic is explicitly defined via **all** in each module and subpackage.
|
|
57
|
+
- Backwards‑compatible imports should target these modules:
|
|
58
|
+
- aiohomematic.central: CentralUnit, CentralConfig and related schemas
|
|
59
|
+
- aiohomematic.client: Client, InterfaceConfig, create_client, get_client
|
|
60
|
+
- aiohomematic.model: device/data point abstractions (see subpackages for details)
|
|
61
|
+
- aiohomematic.exceptions: library exception types intended for consumers
|
|
62
|
+
- aiohomematic.const: constants and enums (stable subset; see module **all**)
|
|
63
|
+
- The top‑level package only exposes **version** to avoid import cycles and keep startup lean. Prefer importing from the specific submodules listed above.
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
|
|
67
|
+
from aiohomematic.central import CentralConfig
|
|
68
|
+
from aiohomematic import client as hmcl
|
|
69
|
+
|
|
70
|
+
cfg = CentralConfig(
|
|
71
|
+
central_id="ccu-main",
|
|
72
|
+
host="ccu.local",
|
|
73
|
+
username="admin",
|
|
74
|
+
password="secret",
|
|
75
|
+
default_callback_port=43439,
|
|
76
|
+
interface_configs={hmcl.InterfaceConfig(interface=hmcl.Interface.HMIP, port=2010, enabled=True)},
|
|
77
|
+
)
|
|
78
|
+
central = cfg.create_central()
|
|
79
|
+
|
|
80
|
+
## Useful links
|
|
81
|
+
|
|
82
|
+
- Changelog: [see](changelog.md) for release history and latest changes.
|
|
83
|
+
- Definition of calculated data points: [see](docs/calculated_data_points.md)
|
|
84
|
+
- Homematic(IP) Local integration: https://github.com/sukramj/homematicip_local
|
|
85
|
+
- Input select helper: [see](docs/input_select_helper.md) for an overview of how to use the input select helper.
|
|
86
|
+
- Troubleshooting with Home Assistant: [see](docs/homeassistant_troubleshooting.md) for common issues and how to debug them.
|
|
87
|
+
- Unignore mechanism: [see](docs/unignore.md) for how to unignore devices that are ignored by default.
|
|
88
|
+
|
|
89
|
+
## Useful developer links
|
|
90
|
+
|
|
91
|
+
- Architecture overview: [see](docs/architecture.md) for an overview of the architecture of the library.
|
|
92
|
+
- Data flow: [see](docs/data_flow.md) for an overview of how data flows through the library.
|
|
93
|
+
- Extending the model: [see](docs/extension_points.md) for adding custom device profiles and calculated data points.
|
|
94
|
+
- Home Assistant lifecycle (discovery, updates, teardown): [see](docs/homeassistant_lifecycle.md) for details on how the integration works and how to debug issues.
|
|
95
|
+
- RSSI fix: [see](docs/rssi_fix.md) for how RSSI values are fixed for Home Assistant.
|
|
96
|
+
- Sequence diagrams: [see](docs/sequence_diagrams.md) for a sequence diagram of how the library works.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2021-2025 Daniel Perna, SukramJ
|
|
1
3
|
"""
|
|
2
4
|
AioHomematic: a Python 3 library to interact with HomeMatic and HomematicIP backends.
|
|
3
5
|
|
|
6
|
+
Public API at the top-level package is defined by __all__.
|
|
7
|
+
|
|
4
8
|
This package provides a high-level API to discover devices and channels, read and write
|
|
5
9
|
parameters (data points), receive events, and manage programs and system variables.
|
|
6
10
|
|
|
@@ -23,7 +27,7 @@ import sys
|
|
|
23
27
|
import threading
|
|
24
28
|
from typing import Final
|
|
25
29
|
|
|
26
|
-
from aiohomematic import central as hmcu
|
|
30
|
+
from aiohomematic import central as hmcu, validator as _ahm_validator
|
|
27
31
|
from aiohomematic.const import VERSION
|
|
28
32
|
|
|
29
33
|
if sys.stdout.isatty():
|
|
@@ -43,5 +47,15 @@ def signal_handler(sig, frame): # type: ignore[no-untyped-def]
|
|
|
43
47
|
asyncio.run_coroutine_threadsafe(central.stop(), asyncio.get_running_loop())
|
|
44
48
|
|
|
45
49
|
|
|
50
|
+
# Perform lightweight startup validation once on import
|
|
51
|
+
try:
|
|
52
|
+
_ahm_validator.validate_startup()
|
|
53
|
+
except Exception as _exc: # pragma: no cover
|
|
54
|
+
# Fail-fast with a clear message if validation fails during import
|
|
55
|
+
raise RuntimeError(f"AioHomematic startup validation failed: {_exc}") from _exc
|
|
56
|
+
|
|
46
57
|
if threading.current_thread() is threading.main_thread() and sys.stdout.isatty():
|
|
47
58
|
signal.signal(signal.SIGINT, signal_handler)
|
|
59
|
+
|
|
60
|
+
# Define public API for the top-level package
|
|
61
|
+
__all__ = ["__version__"]
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2021-2025 Daniel Perna, SukramJ
|
|
1
3
|
"""Module with support for loop interaction."""
|
|
2
4
|
|
|
3
5
|
from __future__ import annotations
|
|
@@ -26,13 +28,24 @@ class Looper:
|
|
|
26
28
|
self._tasks: Final[set[asyncio.Future[Any]]] = set()
|
|
27
29
|
self._loop = asyncio.get_event_loop()
|
|
28
30
|
|
|
29
|
-
async def block_till_done(self) -> None:
|
|
30
|
-
"""
|
|
31
|
+
async def block_till_done(self, wait_time: float | None = None) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Block until all pending work is done.
|
|
34
|
+
|
|
35
|
+
If wait_time is set, stop waiting after the given number of seconds and log remaining tasks.
|
|
36
|
+
"""
|
|
31
37
|
# To flush out any call_soon_threadsafe
|
|
32
38
|
await asyncio.sleep(0)
|
|
33
39
|
start_time: float | None = None
|
|
40
|
+
deadline: float | None = (monotonic() + wait_time) if wait_time is not None else None
|
|
34
41
|
current_task = asyncio.current_task()
|
|
35
42
|
while tasks := [task for task in self._tasks if task is not current_task and not cancelling(task)]:
|
|
43
|
+
# If we have a deadline and have exceeded it, log remaining tasks and break
|
|
44
|
+
if deadline is not None and monotonic() >= deadline:
|
|
45
|
+
for task in tasks:
|
|
46
|
+
_LOGGER.warning("Shutdown timeout reached; task still pending: %s", task)
|
|
47
|
+
break
|
|
48
|
+
|
|
36
49
|
await self._await_and_log_pending(tasks)
|
|
37
50
|
|
|
38
51
|
if start_time is None:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2021-2025 Daniel Perna, SukramJ
|
|
1
3
|
"""
|
|
2
4
|
Persistent caches used to persist HomeMatic metadata between runs.
|
|
3
5
|
|
|
@@ -208,9 +210,15 @@ class DeviceDescriptionCache(BasePersistentCache):
|
|
|
208
210
|
|
|
209
211
|
def add_device(self, interface_id: str, device_description: DeviceDescription) -> None:
|
|
210
212
|
"""Add a device to the cache."""
|
|
213
|
+
# Fast-path: If the address is not yet known, skip costly removal operations.
|
|
214
|
+
if (address := device_description["ADDRESS"]) not in self._device_descriptions[interface_id]:
|
|
215
|
+
self._raw_device_descriptions[interface_id].append(device_description)
|
|
216
|
+
self._process_device_description(interface_id=interface_id, device_description=device_description)
|
|
217
|
+
return
|
|
218
|
+
# Address exists: remove old entries before adding the new description.
|
|
211
219
|
self._remove_device(
|
|
212
220
|
interface_id=interface_id,
|
|
213
|
-
addresses_to_remove=[
|
|
221
|
+
addresses_to_remove=[address],
|
|
214
222
|
)
|
|
215
223
|
self._raw_device_descriptions[interface_id].append(device_description)
|
|
216
224
|
self._process_device_description(interface_id=interface_id, device_description=device_description)
|
|
@@ -228,23 +236,22 @@ class DeviceDescriptionCache(BasePersistentCache):
|
|
|
228
236
|
|
|
229
237
|
def _remove_device(self, interface_id: str, addresses_to_remove: list[str]) -> None:
|
|
230
238
|
"""Remove a device from the cache."""
|
|
239
|
+
# Use a set for faster membership checks
|
|
240
|
+
addresses_set = set(addresses_to_remove)
|
|
231
241
|
self._raw_device_descriptions[interface_id] = [
|
|
232
|
-
device
|
|
233
|
-
for device in self._raw_device_descriptions[interface_id]
|
|
234
|
-
if device["ADDRESS"] not in addresses_to_remove
|
|
242
|
+
device for device in self._raw_device_descriptions[interface_id] if device["ADDRESS"] not in addresses_set
|
|
235
243
|
]
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
return tuple(self._addresses[interface_id].keys())
|
|
244
|
+
addr_map = self._addresses[interface_id]
|
|
245
|
+
desc_map = self._device_descriptions[interface_id]
|
|
246
|
+
for address in addresses_set:
|
|
247
|
+
# Pop with default to avoid KeyError and try/except overhead
|
|
248
|
+
if ADDRESS_SEPARATOR not in address:
|
|
249
|
+
addr_map.pop(address, None)
|
|
250
|
+
desc_map.pop(address, None)
|
|
251
|
+
|
|
252
|
+
def get_addresses(self, interface_id: str) -> frozenset[str]:
|
|
253
|
+
"""Return the addresses by interface as a set."""
|
|
254
|
+
return frozenset(self._addresses[interface_id])
|
|
248
255
|
|
|
249
256
|
def get_device_descriptions(self, interface_id: str) -> Mapping[str, DeviceDescription]:
|
|
250
257
|
"""Return the devices by interface."""
|
|
@@ -288,9 +295,10 @@ class DeviceDescriptionCache(BasePersistentCache):
|
|
|
288
295
|
device_address = get_device_address(address)
|
|
289
296
|
self._device_descriptions[interface_id][address] = device_description
|
|
290
297
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
298
|
+
# Avoid redundant membership checks; set.add is idempotent and cheaper than check+add
|
|
299
|
+
addr_set = self._addresses[interface_id][device_address]
|
|
300
|
+
addr_set.add(device_address)
|
|
301
|
+
addr_set.add(address)
|
|
294
302
|
|
|
295
303
|
async def load(self) -> DataOperationResult:
|
|
296
304
|
"""Load device data from disk into _device_description_cache."""
|
|
@@ -420,13 +428,12 @@ class ParamsetDescriptionCache(BasePersistentCache):
|
|
|
420
428
|
def _add_address_parameter(self, channel_address: str, paramsets: list[dict[str, Any]]) -> None:
|
|
421
429
|
"""Add address parameter to cache."""
|
|
422
430
|
device_address, channel_no = get_split_channel_address(channel_address)
|
|
431
|
+
cache = self._address_parameter_cache
|
|
423
432
|
for paramset in paramsets:
|
|
424
433
|
if not paramset:
|
|
425
434
|
continue
|
|
426
435
|
for parameter in paramset:
|
|
427
|
-
|
|
428
|
-
self._address_parameter_cache[(device_address, parameter)] = set()
|
|
429
|
-
self._address_parameter_cache[(device_address, parameter)].add(channel_no)
|
|
436
|
+
cache.setdefault((device_address, parameter), set()).add(channel_no)
|
|
430
437
|
|
|
431
438
|
async def load(self) -> DataOperationResult:
|
|
432
439
|
"""Load paramset descriptions from disk into paramset cache."""
|