harbor-python 1.2.1__tar.gz → 1.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.
- harbor_python-1.3.0/PKG-INFO +185 -0
- harbor_python-1.3.0/README.md +156 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/pyproject.toml +22 -3
- harbor_python-1.2.1/PKG-INFO +0 -21
- harbor_python-1.2.1/README.md +0 -3
- {harbor_python-1.2.1 → harbor_python-1.3.0}/.gitignore +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/LICENSE +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/__init__.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/config.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/core.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/data/__init__.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/data/mqtt_models.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/device.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/devices/camera.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/devices/monitor.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/events.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/mqtt.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/py.typed +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/state.py +0 -0
- {harbor_python-1.2.1 → harbor_python-1.3.0}/harbor/utils.py +0 -0
|
@@ -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.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Harbor Python
|
|
2
|
+
|
|
3
|
+
Async Python client for connecting locally to Harbor Sleep Cameras.
|
|
4
|
+
|
|
5
|
+
`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.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install harbor-python
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Python 3.11 or newer is required.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import asyncio
|
|
19
|
+
|
|
20
|
+
from harbor import Harbor, HarborCamera, HarborCameraConfig, HeartbeatUpdate
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def main() -> None:
|
|
24
|
+
config = HarborCameraConfig(
|
|
25
|
+
serial="CAMERA_SERIAL",
|
|
26
|
+
ip_address="192.168.1.50",
|
|
27
|
+
cert_path="/path/to/cert.pem",
|
|
28
|
+
key_path="/path/to/key.pem",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
harbor = Harbor()
|
|
32
|
+
camera = HarborCamera(config)
|
|
33
|
+
|
|
34
|
+
camera.subscribe_updates(
|
|
35
|
+
lambda state: print(f"{state.serial} values: {state.values}")
|
|
36
|
+
)
|
|
37
|
+
camera.subscribe(
|
|
38
|
+
HeartbeatUpdate,
|
|
39
|
+
lambda event: print(f"temperature: {event.payload.temperature}"),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
harbor.add_device(camera)
|
|
43
|
+
harbor.add_camera_connection(config)
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
await harbor.start()
|
|
47
|
+
await asyncio.Event().wait()
|
|
48
|
+
finally:
|
|
49
|
+
await harbor.stop()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
asyncio.run(main())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
On Windows, `aiomqtt` works best with the selector event loop policy:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import asyncio
|
|
59
|
+
import sys
|
|
60
|
+
|
|
61
|
+
if sys.platform == "win32":
|
|
62
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Certificate Configuration
|
|
66
|
+
|
|
67
|
+
`HarborCameraConfig` accepts certificate material in either form:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
HarborCameraConfig(
|
|
71
|
+
serial="CAMERA_SERIAL",
|
|
72
|
+
ip_address="192.168.1.50",
|
|
73
|
+
cert_pem="<certificate PEM contents>",
|
|
74
|
+
key_pem="<private key PEM contents>",
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
or:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
HarborCameraConfig(
|
|
82
|
+
serial="CAMERA_SERIAL",
|
|
83
|
+
ip_address="192.168.1.50",
|
|
84
|
+
cert_path="/path/to/cert.pem",
|
|
85
|
+
key_path="/path/to/key.pem",
|
|
86
|
+
cert_dir="/path/to/ca-directory",
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
When both PEM strings and file paths are provided, the in-memory PEM values are used.
|
|
91
|
+
|
|
92
|
+
## Commands
|
|
93
|
+
|
|
94
|
+
Camera commands can be published directly:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
await harbor.publish_camera_command("CAMERA_SERIAL", "some-command", {"value": True})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
For request/response commands, use `request_camera_command` or the settings helper:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
settings = await harbor.get_camera_settings("CAMERA_SERIAL")
|
|
104
|
+
print(settings.settings)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## WHIP Endpoint
|
|
108
|
+
|
|
109
|
+
Harbor cameras allow custom WHIP endpoints. This tells the camera where to stream and works with tools that support WHIP, including go2rtc and Frigate.
|
|
110
|
+
|
|
111
|
+
### Setting up WHIP Ingestion (go2rtc)
|
|
112
|
+
|
|
113
|
+
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).
|
|
114
|
+
|
|
115
|
+
Once go2rtc is running, add a stream keyed by your camera serial number:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
api:
|
|
119
|
+
listen: ":1984" # Change this if you use a non-default port.
|
|
120
|
+
|
|
121
|
+
streams:
|
|
122
|
+
"CAMERA_SERIAL":
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Setting up WHIP Ingestion (Frigate)
|
|
126
|
+
|
|
127
|
+
Frigate runs an instance of go2rtc under the hood. Add the following to your Frigate config:
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
go2rtc:
|
|
131
|
+
api:
|
|
132
|
+
listen: ":1984"
|
|
133
|
+
streams:
|
|
134
|
+
"CAMERA_SERIAL":
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Setting the Endpoint
|
|
138
|
+
|
|
139
|
+
1. Open your Harbor app
|
|
140
|
+
2. Go to Live
|
|
141
|
+
3. Open Camera Settings
|
|
142
|
+
4. Scroll down and click on Advanced Settings
|
|
143
|
+
5. Enter the WHIP endpoint, for example: `http://192.168.1.10:1984/api/webrtc?dst=CAMERA_SERIAL`
|
|
144
|
+
|
|
145
|
+
Replace `CAMERA_SERIAL` with your camera serial number and `192.168.1.10` with the IP address of your go2rtc or Frigate server.
|
|
146
|
+
|
|
147
|
+
## Development
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
uv sync
|
|
151
|
+
uv run pytest
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
Licensed under the Apache License 2.0.
|
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "harbor-python"
|
|
3
|
-
version = "1.
|
|
4
|
-
description = "
|
|
3
|
+
version = "1.3.0"
|
|
4
|
+
description = "Async local client for Harbor Sleep Cameras"
|
|
5
5
|
authors = [{name="Andres Garcia"},{name = "Lash-L"}]
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.11, <4"
|
|
8
8
|
license = "Apache-2.0"
|
|
9
9
|
keywords = [
|
|
10
10
|
"harbor",
|
|
11
|
+
"harbor sleep",
|
|
11
12
|
"baby",
|
|
12
|
-
"baby monitor"
|
|
13
|
+
"baby monitor",
|
|
14
|
+
"camera",
|
|
15
|
+
"mqtt",
|
|
16
|
+
"whip",
|
|
17
|
+
"webrtc",
|
|
13
18
|
]
|
|
14
19
|
classifiers = [
|
|
15
20
|
"Development Status :: 5 - Production/Stable",
|
|
21
|
+
"Framework :: AsyncIO",
|
|
16
22
|
"Intended Audience :: Developers",
|
|
17
23
|
"Natural Language :: English",
|
|
18
24
|
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
19
30
|
"Topic :: Software Development :: Libraries",
|
|
31
|
+
"Typing :: Typed",
|
|
20
32
|
]
|
|
21
33
|
dependencies = [
|
|
22
34
|
"aiomqtt>=2.5.0",
|
|
23
35
|
"pydantic>=2.12.2",
|
|
24
36
|
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/Harbor-Systems/harbor-python"
|
|
40
|
+
Repository = "https://github.com/Harbor-Systems/harbor-python"
|
|
41
|
+
Issues = "https://github.com/Harbor-Systems/harbor-python/issues"
|
|
42
|
+
Changelog = "https://github.com/Harbor-Systems/harbor-python/blob/main/CHANGELOG.md"
|
|
43
|
+
|
|
25
44
|
[tool.hatch.build.targets.sdist]
|
|
26
45
|
include = ["harbor"]
|
|
27
46
|
|
harbor_python-1.2.1/PKG-INFO
DELETED
|
@@ -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.
|
harbor_python-1.2.1/README.md
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|