desk2ha-agent 0.3.0__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.
Files changed (97) hide show
  1. desk2ha_agent-0.3.0/.github/workflows/ci.yml +32 -0
  2. desk2ha_agent-0.3.0/.github/workflows/release.yml +23 -0
  3. desk2ha_agent-0.3.0/.gitignore +20 -0
  4. desk2ha_agent-0.3.0/.pre-commit-config.yaml +7 -0
  5. desk2ha_agent-0.3.0/CHANGELOG.md +11 -0
  6. desk2ha_agent-0.3.0/CLAUDE.md +57 -0
  7. desk2ha_agent-0.3.0/LICENSE +201 -0
  8. desk2ha_agent-0.3.0/PKG-INFO +198 -0
  9. desk2ha_agent-0.3.0/README.md +153 -0
  10. desk2ha_agent-0.3.0/config.toml +31 -0
  11. desk2ha_agent-0.3.0/desk2ha_agent/__init__.py +3 -0
  12. desk2ha_agent-0.3.0/desk2ha_agent/__main__.py +225 -0
  13. desk2ha_agent-0.3.0/desk2ha_agent/collector/__init__.py +1 -0
  14. desk2ha_agent-0.3.0/desk2ha_agent/collector/base.py +114 -0
  15. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/__init__.py +1 -0
  16. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/ble_battery.py +127 -0
  17. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/ddcci.py +641 -0
  18. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/headsetcontrol.py +159 -0
  19. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/hid_battery.py +133 -0
  20. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/network.py +155 -0
  21. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/usb_devices.py +246 -0
  22. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/usb_pd.py +210 -0
  23. desk2ha_agent-0.3.0/desk2ha_agent/collector/generic/uvc.py +157 -0
  24. desk2ha_agent-0.3.0/desk2ha_agent/collector/platform/__init__.py +1 -0
  25. desk2ha_agent-0.3.0/desk2ha_agent/collector/platform/linux.py +314 -0
  26. desk2ha_agent-0.3.0/desk2ha_agent/collector/platform/macos.py +233 -0
  27. desk2ha_agent-0.3.0/desk2ha_agent/collector/platform/windows.py +429 -0
  28. desk2ha_agent-0.3.0/desk2ha_agent/collector/vendor/__init__.py +1 -0
  29. desk2ha_agent-0.3.0/desk2ha_agent/collector/vendor/dell_dcm.py +315 -0
  30. desk2ha_agent-0.3.0/desk2ha_agent/collector/vendor/hp_wmi.py +137 -0
  31. desk2ha_agent-0.3.0/desk2ha_agent/collector/vendor/lenovo_wmi.py +206 -0
  32. desk2ha_agent-0.3.0/desk2ha_agent/collector/vendor/logitech_litra.py +241 -0
  33. desk2ha_agent-0.3.0/desk2ha_agent/config.py +99 -0
  34. desk2ha_agent-0.3.0/desk2ha_agent/helper/__init__.py +1 -0
  35. desk2ha_agent-0.3.0/desk2ha_agent/helper/__main__.py +129 -0
  36. desk2ha_agent-0.3.0/desk2ha_agent/helper/client.py +52 -0
  37. desk2ha_agent-0.3.0/desk2ha_agent/helper/registry.py +13 -0
  38. desk2ha_agent-0.3.0/desk2ha_agent/helper/server.py +135 -0
  39. desk2ha_agent-0.3.0/desk2ha_agent/images/__init__.py +1 -0
  40. desk2ha_agent-0.3.0/desk2ha_agent/images/device_icons.py +93 -0
  41. desk2ha_agent-0.3.0/desk2ha_agent/lifecycle/__init__.py +1 -0
  42. desk2ha_agent-0.3.0/desk2ha_agent/lifecycle/config_api.py +124 -0
  43. desk2ha_agent-0.3.0/desk2ha_agent/lifecycle/self_update.py +40 -0
  44. desk2ha_agent-0.3.0/desk2ha_agent/lifecycle/service_manager.py +38 -0
  45. desk2ha_agent-0.3.0/desk2ha_agent/lifecycle/system_actions.py +106 -0
  46. desk2ha_agent-0.3.0/desk2ha_agent/lifecycle/version_check.py +74 -0
  47. desk2ha_agent-0.3.0/desk2ha_agent/plugin_registry.py +94 -0
  48. desk2ha_agent-0.3.0/desk2ha_agent/scheduler.py +72 -0
  49. desk2ha_agent-0.3.0/desk2ha_agent/state.py +47 -0
  50. desk2ha_agent-0.3.0/desk2ha_agent/transport/__init__.py +7 -0
  51. desk2ha_agent-0.3.0/desk2ha_agent/transport/base.py +17 -0
  52. desk2ha_agent-0.3.0/desk2ha_agent/transport/http.py +424 -0
  53. desk2ha_agent-0.3.0/desk2ha_agent/transport/mqtt.py +682 -0
  54. desk2ha_agent-0.3.0/desk2ha_agent/transport/zeroconf.py +103 -0
  55. desk2ha_agent-0.3.0/desk2ha_agent/tray/__init__.py +1 -0
  56. desk2ha_agent-0.3.0/desk2ha_agent/tray/icon.svg +6 -0
  57. desk2ha_agent-0.3.0/desk2ha_agent/tray/tray_helper.py +129 -0
  58. desk2ha_agent-0.3.0/examples/full-config.toml +45 -0
  59. desk2ha_agent-0.3.0/examples/minimal-config.toml +8 -0
  60. desk2ha_agent-0.3.0/pyproject.toml +85 -0
  61. desk2ha_agent-0.3.0/scripts/generate-models.sh +15 -0
  62. desk2ha_agent-0.3.0/scripts/install-helper-service.ps1 +33 -0
  63. desk2ha_agent-0.3.0/scripts/install-service.ps1 +30 -0
  64. desk2ha_agent-0.3.0/scripts/lint.sh +16 -0
  65. desk2ha_agent-0.3.0/tests/__init__.py +0 -0
  66. desk2ha_agent-0.3.0/tests/conftest.py +1 -0
  67. desk2ha_agent-0.3.0/tests/integration/__init__.py +0 -0
  68. desk2ha_agent-0.3.0/tests/platform/__init__.py +0 -0
  69. desk2ha_agent-0.3.0/tests/unit/__init__.py +0 -0
  70. desk2ha_agent-0.3.0/tests/unit/collector/__init__.py +0 -0
  71. desk2ha_agent-0.3.0/tests/unit/collector/test_base.py +70 -0
  72. desk2ha_agent-0.3.0/tests/unit/collector/test_ble_battery.py +12 -0
  73. desk2ha_agent-0.3.0/tests/unit/collector/test_ddcci.py +18 -0
  74. desk2ha_agent-0.3.0/tests/unit/collector/test_dell_dcm.py +154 -0
  75. desk2ha_agent-0.3.0/tests/unit/collector/test_headsetcontrol.py +37 -0
  76. desk2ha_agent-0.3.0/tests/unit/collector/test_hid_battery.py +11 -0
  77. desk2ha_agent-0.3.0/tests/unit/collector/test_logitech_litra.py +76 -0
  78. desk2ha_agent-0.3.0/tests/unit/collector/test_network.py +112 -0
  79. desk2ha_agent-0.3.0/tests/unit/collector/test_usb_devices.py +47 -0
  80. desk2ha_agent-0.3.0/tests/unit/collector/test_usb_pd.py +78 -0
  81. desk2ha_agent-0.3.0/tests/unit/collector/test_uvc.py +11 -0
  82. desk2ha_agent-0.3.0/tests/unit/helper/__init__.py +0 -0
  83. desk2ha_agent-0.3.0/tests/unit/helper/test_client.py +63 -0
  84. desk2ha_agent-0.3.0/tests/unit/helper/test_registry.py +15 -0
  85. desk2ha_agent-0.3.0/tests/unit/helper/test_server.py +96 -0
  86. desk2ha_agent-0.3.0/tests/unit/lifecycle/__init__.py +0 -0
  87. desk2ha_agent-0.3.0/tests/unit/lifecycle/test_config_api.py +32 -0
  88. desk2ha_agent-0.3.0/tests/unit/lifecycle/test_system_actions.py +94 -0
  89. desk2ha_agent-0.3.0/tests/unit/lifecycle/test_version_check.py +29 -0
  90. desk2ha_agent-0.3.0/tests/unit/test_config.py +53 -0
  91. desk2ha_agent-0.3.0/tests/unit/test_plugin_registry.py +11 -0
  92. desk2ha_agent-0.3.0/tests/unit/test_scheduler.py +59 -0
  93. desk2ha_agent-0.3.0/tests/unit/test_state.py +39 -0
  94. desk2ha_agent-0.3.0/tests/unit/transport/__init__.py +1 -0
  95. desk2ha_agent-0.3.0/tests/unit/transport/test_commands.py +155 -0
  96. desk2ha_agent-0.3.0/tests/unit/transport/test_http.py +95 -0
  97. desk2ha_agent-0.3.0/tests/unit/transport/test_mqtt.py +154 -0
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - run: pip install ruff
18
+ - run: ruff check desk2ha_agent/ tests/
19
+ - run: ruff format --check desk2ha_agent/ tests/
20
+
21
+ test:
22
+ strategy:
23
+ matrix:
24
+ python: ["3.11", "3.12", "3.13"]
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python }}
31
+ - run: pip install -e ".[dev]"
32
+ - run: pytest tests/ -x --tb=short
@@ -0,0 +1,23 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - run: pip install build
19
+ - run: python -m build
20
+ - uses: softprops/action-gh-release@v2
21
+ with:
22
+ files: dist/*
23
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,20 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ *.egg
9
+ .eggs/
10
+ .venv/
11
+ venv/
12
+ *.log
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ .coverage
17
+ htmlcov/
18
+ *.toml.bak
19
+ desk2ha-agent.toml
20
+ test-config.toml
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.11.6
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Added
8
+ - Initial project structure
9
+ - Collector ABC and plugin registry scaffold
10
+ - CI pipeline (ruff, mypy, pytest)
11
+ - Pre-commit hooks
@@ -0,0 +1,57 @@
1
+ # desk2ha-agent — Development Guide
2
+
3
+ You are working on the **Desk2HA Agent**, a cross-platform Python service that
4
+ runs on endpoint devices and exposes local telemetry via HTTP and MQTT.
5
+
6
+ ## Quick Reference
7
+
8
+ - Python package: `desk2ha_agent`
9
+ - Entry point: `python -m desk2ha_agent`
10
+ - Config format: TOML (`desk2ha-agent.toml`)
11
+ - API port: 9693
12
+
13
+ ## Autonomie-Regeln
14
+
15
+ Du darfst OHNE Rueckfrage:
16
+ - Code, Tests, Doku auf Feature-Branches schreiben, committen und pushen
17
+ - Draft-PRs erstellen
18
+ - Lint/Format/Type-Fehler fixen
19
+ - Dependencies in pyproject.toml hinzufuegen (mit Begruendung im Commit)
20
+
21
+ Du MUSST den User fragen fuer:
22
+ - PR auf main mergen (ausser docs/*)
23
+ - Release taggen
24
+ - Deploy auf Live-System
25
+ - OpenAPI Spec oder ARCHITECTURE.md aendern
26
+ - CLAUDE.md aendern
27
+
28
+ ## Vor jedem Commit
29
+
30
+ ```bash
31
+ ruff check . && ruff format --check . && mypy desk2ha_agent/ && pytest tests/unit/ -x
32
+ ```
33
+
34
+ ## Projektstruktur
35
+
36
+ - `desk2ha_agent/collector/platform/` — OS-specific host telemetry (Windows/Linux/macOS)
37
+ - `desk2ha_agent/collector/generic/` — Standard protocols (DDC/CI, UVC, BLE, HID)
38
+ - `desk2ha_agent/collector/vendor/` — Vendor plugins (Dell, HP, Lenovo, Logitech)
39
+ - `desk2ha_agent/transport/` — HTTP, MQTT, Prometheus transports
40
+ - `desk2ha_agent/lifecycle/` — Self-update, config API, service manager
41
+ - `desk2ha_agent/images/` — Product image fetcher + cache
42
+ - `desk2ha_agent/tray/` — Windows system tray helper
43
+
44
+ ## Coding Standards
45
+
46
+ - Type hints on all public functions
47
+ - `from __future__ import annotations` in every module
48
+ - Async by default (aiohttp event loop)
49
+ - Collectors inherit from `collector.base.Collector`
50
+ - Use `logging` (no print statements)
51
+ - Keep platform-specific imports behind `sys.platform` guards
52
+
53
+ ## Commit Convention
54
+
55
+ Format: `{type}: {description}`
56
+ Types: feat, fix, refactor, test, docs, ci, chore
57
+ All commits end with: `Co-Authored-By: Claude <noreply@anthropic.com>`
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: desk2ha-agent
3
+ Version: 0.3.0
4
+ Summary: Multi-vendor desktop telemetry agent for Home Assistant
5
+ Project-URL: Homepage, https://github.com/maximusIIxII/desk2ha-agent
6
+ Project-URL: Repository, https://github.com/maximusIIxII/desk2ha-agent
7
+ Project-URL: Issues, https://github.com/maximusIIxII/desk2ha-agent/issues
8
+ Author: maximusIIxII
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Home Automation
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: aiohttp>=3.9
21
+ Requires-Dist: hidapi>=0.14
22
+ Requires-Dist: monitorcontrol>=3.0
23
+ Requires-Dist: paho-mqtt>=2.0
24
+ Requires-Dist: psutil>=5.9
25
+ Requires-Dist: pydantic>=2.5
26
+ Requires-Dist: zeroconf>=0.131
27
+ Provides-Extra: dev
28
+ Requires-Dist: datamodel-code-generator>=0.25; extra == 'dev'
29
+ Requires-Dist: mypy>=1.9; extra == 'dev'
30
+ Requires-Dist: pre-commit>=3.7; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
32
+ Requires-Dist: pytest>=7.0; extra == 'dev'
33
+ Requires-Dist: ruff>=0.4; extra == 'dev'
34
+ Provides-Extra: linux
35
+ Requires-Dist: bleak>=0.21; extra == 'linux'
36
+ Provides-Extra: macos
37
+ Requires-Dist: bleak>=0.21; extra == 'macos'
38
+ Provides-Extra: windows
39
+ Requires-Dist: pillow>=10.0; extra == 'windows'
40
+ Requires-Dist: pystray>=0.19; extra == 'windows'
41
+ Requires-Dist: pywin32>=306; extra == 'windows'
42
+ Requires-Dist: winrt-windows-devices-bluetooth>=2.0; extra == 'windows'
43
+ Requires-Dist: wmi>=1.5; extra == 'windows'
44
+ Description-Content-Type: text/markdown
45
+
46
+ # Desk2HA Agent
47
+
48
+ Multi-vendor desktop telemetry agent for [Home Assistant](https://www.home-assistant.io/).
49
+
50
+ Collects hardware metrics, peripheral status, and display settings from Windows, Linux, and macOS — and exposes them via HTTP and MQTT for the [Desk2HA HA integration](https://github.com/maximusIIxII/hass-desk2ha).
51
+
52
+ ## Features
53
+
54
+ - **Cross-platform**: Windows, Linux, macOS
55
+ - **3-tier collector model**: Platform (OS) → Generic (DDC/CI, HID, BLE) → Vendor (Dell, HP, ...)
56
+ - **Display control**: Brightness, contrast, volume, input source, KVM switch via DDC/CI
57
+ - **Dual transport**: HTTP API (OpenAPI v2.0.0) + MQTT with HA Discovery
58
+ - **Auto-discovery**: Zeroconf/mDNS (`_desk2ha._tcp.local.`)
59
+ - **Self-update**: Version check via GitHub Releases + pip upgrade
60
+ - **System tray**: Windows tray icon with status menu
61
+
62
+ ## Collectors
63
+
64
+ | Tier | Collector | Metrics |
65
+ |------|-----------|---------|
66
+ | Platform | Windows (WMI + psutil) | CPU, RAM, disk, battery, network, GPU, OS info |
67
+ | Platform | Linux (sysfs + psutil) | Same as above |
68
+ | Platform | macOS (IOKit + psutil) | Same as above |
69
+ | Generic | DDC/CI | Monitor brightness, contrast, volume, input, power, KVM, PBP |
70
+ | Generic | USB PD | Charger connected, voltage, charging state |
71
+ | Generic | HeadsetControl | Headset battery, sidetone, LED, chatmix |
72
+ | Generic | HID Battery | USB peripheral battery levels |
73
+ | Generic | BLE Battery | Bluetooth device batteries |
74
+ | Vendor | Dell Command Monitor | CPU/GPU/SSD thermals, fan speeds, AC adapter wattage |
75
+
76
+ ## Installation
77
+
78
+ ```bash
79
+ pip install desk2ha-agent
80
+ # Windows extras (WMI, tray icon):
81
+ pip install desk2ha-agent[windows]
82
+ ```
83
+
84
+ ## Quick Start
85
+
86
+ 1. Create a config file (`desk2ha-agent.toml`):
87
+
88
+ ```toml
89
+ [http]
90
+ enabled = true
91
+ bind = "0.0.0.0"
92
+ port = 9693
93
+ auth_token = "YOUR_RANDOM_TOKEN"
94
+ ```
95
+
96
+ 2. Run the agent:
97
+
98
+ ```bash
99
+ desk2ha-agent --config desk2ha-agent.toml
100
+ ```
101
+
102
+ 3. In Home Assistant, add the [Desk2HA integration](https://github.com/maximusIIxII/hass-desk2ha) and point it to `http://<agent-ip>:9693`.
103
+
104
+ ## Configuration
105
+
106
+ See [`examples/full-config.toml`](examples/full-config.toml) for all options.
107
+
108
+ | Section | Key Options |
109
+ |---------|-------------|
110
+ | `[http]` | `bind`, `port`, `auth_token` |
111
+ | `[mqtt]` | `broker`, `port`, `username`, `password_env`, `base_topic` |
112
+ | `[collectors]` | `disabled`, `intervals` (per-collector poll rate) |
113
+ | `[logging]` | `level` (DEBUG/INFO/WARNING) |
114
+
115
+ ## API Endpoints
116
+
117
+ | Method | Path | Auth | Description |
118
+ |--------|------|------|-------------|
119
+ | GET | `/v1/health` | No | Health check |
120
+ | GET | `/v1/info` | Yes | Device identity + collector status |
121
+ | GET | `/v1/metrics` | Yes | All collected metrics |
122
+ | GET | `/v1/commands` | Yes | List available commands |
123
+ | POST | `/v1/commands` | Yes | Execute a command (e.g. set brightness) |
124
+ | GET | `/v1/update/check` | Yes | Check for new agent release |
125
+ | POST | `/v1/update/install` | Yes | Install agent update |
126
+
127
+ ## Recommended Vendor Software
128
+
129
+ The agent works out of the box with basic metrics via standard OS APIs. For **full telemetry** (detailed thermals, fan speeds, battery health, thermal profile control), install the vendor-specific software for your hardware:
130
+
131
+ ### Dell
132
+
133
+ | Software | What it unlocks | Download |
134
+ |----------|----------------|----------|
135
+ | **Dell Command \| Monitor** | CPU/GPU/SSD/skin thermals, fan RPM, AC adapter wattage, thermal profile control | [Dell Support](https://www.dell.com/support/kbdoc/en-us/000177080/dell-command-monitor) |
136
+ | **Dell Peripheral Manager** | Webcam settings, keyboard backlight, mouse DPI for Dell peripherals | [Dell Support](https://www.dell.com/support/kbdoc/en-us/000201446/dell-peripheral-manager) |
137
+
138
+ ### HP
139
+
140
+ | Software | What it unlocks | Download |
141
+ |----------|----------------|----------|
142
+ | **HP System Event Utility** | BIOS settings, thermal profile, fan control | [HP Support](https://support.hp.com/drivers) (search your model) |
143
+ | **HP Notifications** | Battery health, power delivery info | Included with HP Support Assistant |
144
+
145
+ ### Lenovo
146
+
147
+ | Software | What it unlocks | Download |
148
+ |----------|----------------|----------|
149
+ | **Lenovo Vantage** | Thermal mode, battery thresholds, keyboard backlight | [Microsoft Store](https://apps.microsoft.com/detail/9WZDNCRFJ4MV) |
150
+ | **Lenovo System Interface Foundation** | WMI access for BIOS settings, fan speed | [Lenovo Support](https://support.lenovo.com/solutions/ht503475) |
151
+
152
+ ### Linux (ThinkPad)
153
+
154
+ | Module | What it unlocks | How to enable |
155
+ |--------|----------------|---------------|
156
+ | `thinkpad_acpi` | Fan speed, thermal mode | Usually auto-loaded. Check: `lsmod \| grep thinkpad` |
157
+ | `ideapad_acpi` | Performance mode (IdeaPad/Legion) | Usually auto-loaded. Check: `lsmod \| grep ideapad` |
158
+
159
+ ### Cross-Platform
160
+
161
+ | Software | What it unlocks | Download |
162
+ |----------|----------------|----------|
163
+ | **HeadsetControl** | Headset battery, sidetone, LED, chatmix (SteelSeries, Corsair, Logitech, HyperX) | [GitHub](https://github.com/Sapd/HeadsetControl/releases) |
164
+
165
+ > **Note:** All vendor software is optional. The agent gracefully skips collectors when the required software is not installed. You can check which collectors are active via `GET /v1/info`.
166
+
167
+ ## Windows Autostart
168
+
169
+ The agent needs an interactive desktop session for DDC/CI monitor control. Use the Startup folder (not a Windows Service):
170
+
171
+ ```
172
+ %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\Desk2HA Agent.vbs
173
+ ```
174
+
175
+ ## Known Issues
176
+
177
+ | Issue | Workaround | Status |
178
+ |-------|------------|--------|
179
+ | **DDC/CI not working as Windows Service** | DDC/CI requires an interactive desktop session (Session 1+). Use Startup folder autostart, not NSSM/Windows Service. | By design (Windows limitation) |
180
+ | **Dell Command Monitor v10.x WMI not available** | DCM v10.13 may not register the `root\dcim\sysman` WMI provider automatically. Ensure the `dcstor64` and `dcevt64` services are running. | Investigating |
181
+ | **Bluetooth peripherals not detected** | Devices connected via Dell Universal Receiver (Bluetooth/RF) are not yet enumerated. Only direct USB devices are listed. | Planned |
182
+ | **Duplicate devices after upgrade** | After upgrading from an older version, orphaned entity registry entries may create duplicate devices. Fix: delete the integration in HA and re-add it. | Known |
183
+ | **Logitech Litra G HUB conflict** | If Logitech G HUB is running, it may hold the HID interface and prevent the agent from reading Litra status. | Close G HUB or disable Litra in G HUB |
184
+
185
+ ## Upcoming Features
186
+
187
+ - **Bluetooth peripheral enumeration**: Detect mouse/keyboard via Dell Universal Receiver and Logitech Bolt
188
+ - **Dell Command Monitor v10 support**: Resolve WMI provider registration for DCM v10.x
189
+ - **Webcam UVC controls**: Brightness, contrast, white balance, FOV, autofocus
190
+ - **Corsair/SteelSeries/Razer plugins**: iCUE SDK, Sonar REST, Synapse integration
191
+ - **Product image system**: Vendor-specific device silhouettes and fetched product photos
192
+ - **Remote agent installation**: Deploy agent from HA UI via SSH/WinRM
193
+ - **Prometheus endpoint**: `/metrics` in Prometheus scrape format
194
+ - **Fleet management**: Multi-agent coordination for enterprise environments
195
+
196
+ ## License
197
+
198
+ Apache-2.0