harbor-python 1.2.1__py3-none-any.whl → 1.3.0__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.
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: harbor-python
3
+ Version: 1.3.0
4
+ Summary: Async local client for Harbor Sleep Cameras
5
+ Project-URL: Homepage, https://github.com/Harbor-Systems/harbor-python
6
+ Project-URL: Repository, https://github.com/Harbor-Systems/harbor-python
7
+ Project-URL: Issues, https://github.com/Harbor-Systems/harbor-python/issues
8
+ Project-URL: Changelog, https://github.com/Harbor-Systems/harbor-python/blob/main/CHANGELOG.md
9
+ Author: Andres Garcia, Lash-L
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: baby,baby monitor,camera,harbor,harbor sleep,mqtt,webrtc,whip
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Natural Language :: English
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: <4,>=3.11
26
+ Requires-Dist: aiomqtt>=2.5.0
27
+ Requires-Dist: pydantic>=2.12.2
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Harbor Python
31
+
32
+ Async Python client for connecting locally to Harbor Sleep Cameras.
33
+
34
+ `harbor-python` speaks directly to Harbor devices on your local network over MQTT, using the camera certificate material issued for your setup. It provides typed event parsing, device state tracking, command publishing, and helpers for configuring local WHIP streaming targets.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install harbor-python
40
+ ```
41
+
42
+ Python 3.11 or newer is required.
43
+
44
+ ## Quick Start
45
+
46
+ ```python
47
+ import asyncio
48
+
49
+ from harbor import Harbor, HarborCamera, HarborCameraConfig, HeartbeatUpdate
50
+
51
+
52
+ async def main() -> None:
53
+ config = HarborCameraConfig(
54
+ serial="CAMERA_SERIAL",
55
+ ip_address="192.168.1.50",
56
+ cert_path="/path/to/cert.pem",
57
+ key_path="/path/to/key.pem",
58
+ )
59
+
60
+ harbor = Harbor()
61
+ camera = HarborCamera(config)
62
+
63
+ camera.subscribe_updates(
64
+ lambda state: print(f"{state.serial} values: {state.values}")
65
+ )
66
+ camera.subscribe(
67
+ HeartbeatUpdate,
68
+ lambda event: print(f"temperature: {event.payload.temperature}"),
69
+ )
70
+
71
+ harbor.add_device(camera)
72
+ harbor.add_camera_connection(config)
73
+
74
+ try:
75
+ await harbor.start()
76
+ await asyncio.Event().wait()
77
+ finally:
78
+ await harbor.stop()
79
+
80
+
81
+ asyncio.run(main())
82
+ ```
83
+
84
+ On Windows, `aiomqtt` works best with the selector event loop policy:
85
+
86
+ ```python
87
+ import asyncio
88
+ import sys
89
+
90
+ if sys.platform == "win32":
91
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
92
+ ```
93
+
94
+ ## Certificate Configuration
95
+
96
+ `HarborCameraConfig` accepts certificate material in either form:
97
+
98
+ ```python
99
+ HarborCameraConfig(
100
+ serial="CAMERA_SERIAL",
101
+ ip_address="192.168.1.50",
102
+ cert_pem="<certificate PEM contents>",
103
+ key_pem="<private key PEM contents>",
104
+ )
105
+ ```
106
+
107
+ or:
108
+
109
+ ```python
110
+ HarborCameraConfig(
111
+ serial="CAMERA_SERIAL",
112
+ ip_address="192.168.1.50",
113
+ cert_path="/path/to/cert.pem",
114
+ key_path="/path/to/key.pem",
115
+ cert_dir="/path/to/ca-directory",
116
+ )
117
+ ```
118
+
119
+ When both PEM strings and file paths are provided, the in-memory PEM values are used.
120
+
121
+ ## Commands
122
+
123
+ Camera commands can be published directly:
124
+
125
+ ```python
126
+ await harbor.publish_camera_command("CAMERA_SERIAL", "some-command", {"value": True})
127
+ ```
128
+
129
+ For request/response commands, use `request_camera_command` or the settings helper:
130
+
131
+ ```python
132
+ settings = await harbor.get_camera_settings("CAMERA_SERIAL")
133
+ print(settings.settings)
134
+ ```
135
+
136
+ ## WHIP Endpoint
137
+
138
+ Harbor cameras allow custom WHIP endpoints. This tells the camera where to stream and works with tools that support WHIP, including go2rtc and Frigate.
139
+
140
+ ### Setting up WHIP Ingestion (go2rtc)
141
+
142
+ You can self-host go2rtc in many ways; see the [go2rtc installation guide](https://go2rtc.org/#installation). If you use Home Assistant, the easiest option is the [go2rtc add-on](https://go2rtc.org/#go2rtc-home-assistant-add-on).
143
+
144
+ Once go2rtc is running, add a stream keyed by your camera serial number:
145
+
146
+ ```yaml
147
+ api:
148
+ listen: ":1984" # Change this if you use a non-default port.
149
+
150
+ streams:
151
+ "CAMERA_SERIAL":
152
+ ```
153
+
154
+ ### Setting up WHIP Ingestion (Frigate)
155
+
156
+ Frigate runs an instance of go2rtc under the hood. Add the following to your Frigate config:
157
+
158
+ ```yaml
159
+ go2rtc:
160
+ api:
161
+ listen: ":1984"
162
+ streams:
163
+ "CAMERA_SERIAL":
164
+ ```
165
+
166
+ ### Setting the Endpoint
167
+
168
+ 1. Open your Harbor app
169
+ 2. Go to Live
170
+ 3. Open Camera Settings
171
+ 4. Scroll down and click on Advanced Settings
172
+ 5. Enter the WHIP endpoint, for example: `http://192.168.1.10:1984/api/webrtc?dst=CAMERA_SERIAL`
173
+
174
+ Replace `CAMERA_SERIAL` with your camera serial number and `192.168.1.10` with the IP address of your go2rtc or Frigate server.
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ uv sync
180
+ uv run pytest
181
+ ```
182
+
183
+ ## License
184
+
185
+ Licensed under the Apache License 2.0.
@@ -11,7 +11,7 @@ harbor/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  harbor/data/mqtt_models.py,sha256=OF36ZoUCOeoaKp4TPggM6HCbowgtkH1zLFTozVJUZYY,4314
12
12
  harbor/devices/camera.py,sha256=ciq8ynsAaZgW0CWYjKiJGAZwk04pNz4uYfnsN0GT0O4,8429
13
13
  harbor/devices/monitor.py,sha256=hzx4lu92h3i_34QyYK392gE7CihqERiOZuLhyzDtDk0,452
14
- harbor_python-1.2.1.dist-info/METADATA,sha256=NOeg3ZjAJU9Ji4zRwKXA_ouXAdHnHcn3m9UVNpx9ixQ,688
15
- harbor_python-1.2.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
16
- harbor_python-1.2.1.dist-info/licenses/LICENSE,sha256=QEOXEfrOQetemKy4k1WN5XCApJdpiRtyV5jLMSToVVw,11344
17
- harbor_python-1.2.1.dist-info/RECORD,,
14
+ harbor_python-1.3.0.dist-info/METADATA,sha256=IP-OCKB2gCcJLnJ54YIFTRh-_EOT0va5EiIJA_BSl68,4999
15
+ harbor_python-1.3.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
16
+ harbor_python-1.3.0.dist-info/licenses/LICENSE,sha256=QEOXEfrOQetemKy4k1WN5XCApJdpiRtyV5jLMSToVVw,11344
17
+ harbor_python-1.3.0.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: harbor-python
3
- Version: 1.2.1
4
- Summary: A package to locally connect to a Harbor Sleep Camera
5
- Author: Andres Garcia, Lash-L
6
- License-Expression: Apache-2.0
7
- License-File: LICENSE
8
- Keywords: baby,baby monitor,harbor
9
- Classifier: Development Status :: 5 - Production/Stable
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Natural Language :: English
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Topic :: Software Development :: Libraries
14
- Requires-Python: <4,>=3.11
15
- Requires-Dist: aiomqtt>=2.5.0
16
- Requires-Dist: pydantic>=2.12.2
17
- Description-Content-Type: text/markdown
18
-
19
- # Harbor Python
20
-
21
- A Python package to locally connect to Harbor Sleep Cameras.