harbor-python 1.2.1__py3-none-any.whl → 1.4.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.
- harbor/__init__.py +2 -0
- harbor/core.py +28 -0
- harbor/devices/camera.py +11 -0
- harbor/events.py +21 -21
- harbor/exceptions.py +12 -0
- harbor/mqtt.py +70 -1
- harbor_python-1.4.0.dist-info/METADATA +185 -0
- harbor_python-1.4.0.dist-info/RECORD +18 -0
- harbor_python-1.2.1.dist-info/METADATA +0 -21
- harbor_python-1.2.1.dist-info/RECORD +0 -17
- {harbor_python-1.2.1.dist-info → harbor_python-1.4.0.dist-info}/WHEEL +0 -0
- {harbor_python-1.2.1.dist-info → harbor_python-1.4.0.dist-info}/licenses/LICENSE +0 -0
harbor/__init__.py
CHANGED
|
@@ -27,12 +27,14 @@ from .events import (
|
|
|
27
27
|
ViewerLeftUpdate,
|
|
28
28
|
parse_message,
|
|
29
29
|
)
|
|
30
|
+
from .exceptions import HarborCommandError
|
|
30
31
|
from .mqtt import HarborMQTTClient
|
|
31
32
|
from .state import HarborDeviceState, HarborEventState, HarborSourceType, HarborViewer
|
|
32
33
|
|
|
33
34
|
__all__ = [
|
|
34
35
|
"Harbor",
|
|
35
36
|
"HarborCameraConfig",
|
|
37
|
+
"HarborCommandError",
|
|
36
38
|
"HarborMQTTClient",
|
|
37
39
|
"HarborDevice",
|
|
38
40
|
"HarborCamera",
|
harbor/core.py
CHANGED
|
@@ -85,6 +85,34 @@ class Harbor:
|
|
|
85
85
|
"""Request the camera settings payload."""
|
|
86
86
|
return await self._get_client(serial).get_settings(timeout=timeout)
|
|
87
87
|
|
|
88
|
+
async def set_camera_on(
|
|
89
|
+
self,
|
|
90
|
+
serial: str,
|
|
91
|
+
camera_on: bool,
|
|
92
|
+
*,
|
|
93
|
+
viewer_id: str | None = None,
|
|
94
|
+
timeout: float = 10.0,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Turn a camera stream on or off and refresh its settings."""
|
|
97
|
+
await self._get_client(serial).set_camera_on(
|
|
98
|
+
camera_on,
|
|
99
|
+
viewer_id=viewer_id,
|
|
100
|
+
timeout=timeout,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
async def set_night_mode(
|
|
104
|
+
self,
|
|
105
|
+
serial: str,
|
|
106
|
+
night_mode: bool,
|
|
107
|
+
*,
|
|
108
|
+
timeout: float = 10.0,
|
|
109
|
+
) -> None:
|
|
110
|
+
"""Turn camera night mode on or off and refresh its settings."""
|
|
111
|
+
await self._get_client(serial).set_night_mode(
|
|
112
|
+
night_mode,
|
|
113
|
+
timeout=timeout,
|
|
114
|
+
)
|
|
115
|
+
|
|
88
116
|
async def handle_message(self, topic: str, payload: Any) -> None:
|
|
89
117
|
"""
|
|
90
118
|
Central message handler.
|
harbor/devices/camera.py
CHANGED
|
@@ -4,11 +4,13 @@ import asyncio
|
|
|
4
4
|
import logging
|
|
5
5
|
|
|
6
6
|
from ..config import HarborCameraConfig
|
|
7
|
+
from ..data.mqtt_models import SettingsEvent
|
|
7
8
|
from ..device import HarborDevice
|
|
8
9
|
from ..events import (
|
|
9
10
|
CameraEventUpdate,
|
|
10
11
|
HarborEvent,
|
|
11
12
|
LocalLivekitHeartbeatUpdate,
|
|
13
|
+
SettingsUpdate,
|
|
12
14
|
ViewerInfo,
|
|
13
15
|
ViewerJoinedUpdate,
|
|
14
16
|
ViewerLeftUpdate,
|
|
@@ -58,6 +60,8 @@ class HarborCamera(HarborDevice):
|
|
|
58
60
|
match event:
|
|
59
61
|
case LocalLivekitHeartbeatUpdate(payload=payload, viewers=viewers):
|
|
60
62
|
self._apply_local_livekit_heartbeat(payload, viewers)
|
|
63
|
+
case SettingsUpdate(payload=payload):
|
|
64
|
+
self._apply_camera_settings(payload)
|
|
61
65
|
case ViewerJoinedUpdate(viewer=viewer):
|
|
62
66
|
self._apply_viewer_joined(viewer)
|
|
63
67
|
case ViewerLeftUpdate(viewer_id=viewer_id):
|
|
@@ -65,6 +69,13 @@ class HarborCamera(HarborDevice):
|
|
|
65
69
|
case CameraEventUpdate():
|
|
66
70
|
self._apply_camera_event(event)
|
|
67
71
|
|
|
72
|
+
def _apply_camera_settings(self, payload: SettingsEvent) -> None:
|
|
73
|
+
"""Apply camera controls exposed by a settings payload."""
|
|
74
|
+
if payload.settings is not None and payload.settings.preference_stream_paused is not None:
|
|
75
|
+
self.state.values["camera_on"] = not payload.settings.preference_stream_paused
|
|
76
|
+
if payload.state is not None and payload.state.video_night_mode is not None:
|
|
77
|
+
self.state.values["night_mode"] = payload.state.video_night_mode
|
|
78
|
+
|
|
68
79
|
def _apply_local_livekit_heartbeat(
|
|
69
80
|
self,
|
|
70
81
|
payload,
|
harbor/events.py
CHANGED
|
@@ -293,52 +293,52 @@ def parse_message(
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
if event_key == "heartbeat":
|
|
296
|
-
if
|
|
297
|
-
return HeartbeatUpdate(payload=
|
|
296
|
+
if heartbeat_payload := _validate_payload(HeartbeatEvent, raw_payload, topic):
|
|
297
|
+
return HeartbeatUpdate(payload=heartbeat_payload, **base_kwargs)
|
|
298
298
|
return RawEventUpdate(payload=raw_payload, **base_kwargs)
|
|
299
299
|
|
|
300
300
|
if event_key == "local_livekit_heartbeat":
|
|
301
|
-
if
|
|
301
|
+
if livekit_payload := _validate_payload(LocalLivekitHeartbeatEvent, raw_payload, topic):
|
|
302
302
|
return LocalLivekitHeartbeatUpdate(
|
|
303
|
-
payload=
|
|
304
|
-
viewers=_extract_viewers_from_local_livekit(
|
|
303
|
+
payload=livekit_payload,
|
|
304
|
+
viewers=_extract_viewers_from_local_livekit(livekit_payload),
|
|
305
305
|
**base_kwargs,
|
|
306
306
|
)
|
|
307
307
|
return RawEventUpdate(payload=raw_payload, **base_kwargs)
|
|
308
308
|
|
|
309
309
|
if event_key == "viewer_joined":
|
|
310
|
-
if
|
|
310
|
+
if viewer_joined_payload := _validate_payload(ViewerJoinedEvent, raw_payload, topic):
|
|
311
311
|
return ViewerJoinedUpdate(
|
|
312
|
-
payload=
|
|
312
|
+
payload=viewer_joined_payload,
|
|
313
313
|
viewer=_extract_viewer_info_from_payload(raw_payload)
|
|
314
314
|
or _extract_viewer_info(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
315
|
+
viewer_joined_payload.viewer_id,
|
|
316
|
+
viewer_joined_payload.identity,
|
|
317
|
+
viewer_joined_payload.client,
|
|
318
|
+
viewer_joined_payload.is_local,
|
|
319
|
+
viewer_joined_payload.role,
|
|
320
320
|
),
|
|
321
321
|
**base_kwargs,
|
|
322
322
|
)
|
|
323
323
|
return RawEventUpdate(payload=raw_payload, **base_kwargs)
|
|
324
324
|
|
|
325
325
|
if event_key == "viewer_left":
|
|
326
|
-
if
|
|
326
|
+
if viewer_left_payload := _validate_payload(ViewerLeftEvent, raw_payload, topic):
|
|
327
327
|
return ViewerLeftUpdate(
|
|
328
|
-
payload=
|
|
328
|
+
payload=viewer_left_payload,
|
|
329
329
|
viewer_id=_extract_viewer_id_from_payload(raw_payload)
|
|
330
330
|
or _coalesce_string(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
viewer_left_payload.viewer_id,
|
|
332
|
+
viewer_left_payload.identity,
|
|
333
|
+
viewer_left_payload.client,
|
|
334
334
|
),
|
|
335
335
|
**base_kwargs,
|
|
336
336
|
)
|
|
337
337
|
return RawEventUpdate(payload=raw_payload, **base_kwargs)
|
|
338
338
|
|
|
339
339
|
if event_key in {"settings", "get_settings"}:
|
|
340
|
-
if
|
|
341
|
-
return SettingsUpdate(payload=
|
|
340
|
+
if settings_payload := _validate_payload(SettingsEvent, raw_payload, topic):
|
|
341
|
+
return SettingsUpdate(payload=settings_payload, **base_kwargs)
|
|
342
342
|
return RawEventUpdate(payload=raw_payload, **base_kwargs)
|
|
343
343
|
|
|
344
344
|
if source_type == "camera":
|
|
@@ -346,9 +346,9 @@ def parse_message(
|
|
|
346
346
|
explicit_state = extract_explicit_event_state(raw_payload)
|
|
347
347
|
|
|
348
348
|
if event_key == "motion_detection":
|
|
349
|
-
if
|
|
349
|
+
if motion_payload := _validate_payload(MotionDetectedEvent, raw_payload, topic):
|
|
350
350
|
return MotionDetectedUpdate(
|
|
351
|
-
payload=
|
|
351
|
+
payload=motion_payload,
|
|
352
352
|
active_seconds=active_seconds,
|
|
353
353
|
explicit_state=explicit_state,
|
|
354
354
|
**base_kwargs,
|
harbor/exceptions.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class HarborCommandError(Exception):
|
|
7
|
+
"""Raised when a Harbor camera rejects a command."""
|
|
8
|
+
|
|
9
|
+
def __init__(self, command: str, response: Any) -> None:
|
|
10
|
+
self.command = command
|
|
11
|
+
self.response = response
|
|
12
|
+
super().__init__(f"Harbor camera rejected command {command!r}: {response!r}")
|
harbor/mqtt.py
CHANGED
|
@@ -12,6 +12,7 @@ from aiomqtt import Client, MqttError
|
|
|
12
12
|
|
|
13
13
|
from .config import HarborCameraConfig
|
|
14
14
|
from .data.mqtt_models import GetCameraSettingsRequest, SettingsEvent
|
|
15
|
+
from .exceptions import HarborCommandError
|
|
15
16
|
from .utils import get_camera_host, get_ssl_cache_key, get_ssl_context
|
|
16
17
|
|
|
17
18
|
if TYPE_CHECKING:
|
|
@@ -23,6 +24,9 @@ DEFAULT_CONNECTION_GRACE_PERIOD = 90.0
|
|
|
23
24
|
DEFAULT_COMMAND_QOS = 2
|
|
24
25
|
DEFAULT_REQUEST_TIMEOUT = 10.0
|
|
25
26
|
GET_SETTINGS_COMMAND = "get-settings"
|
|
27
|
+
PAUSE_STREAM_COMMAND = "pause-stream"
|
|
28
|
+
UNPAUSE_STREAM_COMMAND = "unpause-stream"
|
|
29
|
+
UPDATE_NIGHT_MODE_COMMAND = "update-night-mode"
|
|
26
30
|
DEFAULT_INITIAL_COMMANDS = (GET_SETTINGS_COMMAND,)
|
|
27
31
|
|
|
28
32
|
|
|
@@ -360,7 +364,7 @@ class HarborMQTTClient:
|
|
|
360
364
|
request = GetCameraSettingsRequest(
|
|
361
365
|
seq=seq or _generate_seq(),
|
|
362
366
|
client=client or self.client_id or f"harbor-client-{self.config.serial}",
|
|
363
|
-
|
|
367
|
+
triggeredBy=triggered_by or "harbor-python",
|
|
364
368
|
)
|
|
365
369
|
return request.model_dump(by_alias=True)
|
|
366
370
|
|
|
@@ -410,6 +414,71 @@ class HarborMQTTClient:
|
|
|
410
414
|
)
|
|
411
415
|
return SettingsEvent.model_validate(response)
|
|
412
416
|
|
|
417
|
+
async def set_camera_on(
|
|
418
|
+
self,
|
|
419
|
+
camera_on: bool,
|
|
420
|
+
*,
|
|
421
|
+
viewer_id: str | None = None,
|
|
422
|
+
timeout: float = DEFAULT_REQUEST_TIMEOUT,
|
|
423
|
+
) -> None:
|
|
424
|
+
"""Turn the camera stream on or off and refresh its settings."""
|
|
425
|
+
command = UNPAUSE_STREAM_COMMAND if camera_on else PAUSE_STREAM_COMMAND
|
|
426
|
+
await self._request_camera_control(
|
|
427
|
+
command,
|
|
428
|
+
{"viewer_id": viewer_id or self.client_id or f"harbor-client-{self.config.serial}"},
|
|
429
|
+
timeout=timeout,
|
|
430
|
+
)
|
|
431
|
+
await self._refresh_settings_after_command(command, timeout=timeout)
|
|
432
|
+
|
|
433
|
+
async def set_night_mode(
|
|
434
|
+
self,
|
|
435
|
+
night_mode: bool,
|
|
436
|
+
*,
|
|
437
|
+
timeout: float = DEFAULT_REQUEST_TIMEOUT,
|
|
438
|
+
) -> None:
|
|
439
|
+
"""Turn camera night mode on or off and refresh its settings."""
|
|
440
|
+
await self._request_camera_control(
|
|
441
|
+
UPDATE_NIGHT_MODE_COMMAND,
|
|
442
|
+
{"night_mode": night_mode},
|
|
443
|
+
timeout=timeout,
|
|
444
|
+
)
|
|
445
|
+
await self._refresh_settings_after_command(
|
|
446
|
+
UPDATE_NIGHT_MODE_COMMAND,
|
|
447
|
+
timeout=timeout,
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
async def _request_camera_control(
|
|
451
|
+
self,
|
|
452
|
+
command: str,
|
|
453
|
+
payload: dict[str, Any],
|
|
454
|
+
*,
|
|
455
|
+
timeout: float,
|
|
456
|
+
) -> Any:
|
|
457
|
+
"""Run a camera control command and reject error responses."""
|
|
458
|
+
response = await self.request_command(command, payload, timeout=timeout)
|
|
459
|
+
if isinstance(response, dict) and (
|
|
460
|
+
response.get("error") or ((status := response.get("status")) is not None and str(status).upper() != "OK")
|
|
461
|
+
):
|
|
462
|
+
raise HarborCommandError(command, response)
|
|
463
|
+
return response
|
|
464
|
+
|
|
465
|
+
async def _refresh_settings_after_command(
|
|
466
|
+
self,
|
|
467
|
+
command: str,
|
|
468
|
+
*,
|
|
469
|
+
timeout: float,
|
|
470
|
+
) -> None:
|
|
471
|
+
"""Refresh settings without turning a successful command into a failure."""
|
|
472
|
+
try:
|
|
473
|
+
await self.get_settings(timeout=timeout)
|
|
474
|
+
except (ConnectionError, MqttError, TimeoutError):
|
|
475
|
+
_LOGGER.debug(
|
|
476
|
+
"Unable to refresh settings after Harbor command %s for camera %s",
|
|
477
|
+
command,
|
|
478
|
+
self.config.serial,
|
|
479
|
+
exc_info=True,
|
|
480
|
+
)
|
|
481
|
+
|
|
413
482
|
def __del__(self) -> None:
|
|
414
483
|
if self._stop_event and not self._stop_event.is_set():
|
|
415
484
|
self._stop_event.set()
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: harbor-python
|
|
3
|
+
Version: 1.4.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,18 @@
|
|
|
1
|
+
harbor/__init__.py,sha256=JDsB7r1tJEquHnUUiF2u6rqubP2cSJMzo7ntooaGyAw,1675
|
|
2
|
+
harbor/config.py,sha256=LXMDaTC_0Z9wF_vTXJG9C0vQ0XHXo4EuFL0-Kwa4-S4,1373
|
|
3
|
+
harbor/core.py,sha256=NcLvH6eFwzcggn-D1DXoPteLCSJVj66OsRYapHTjjwE,4213
|
|
4
|
+
harbor/device.py,sha256=YvaFWieXJ-EzQJU8VQo_ZERl65CynITTAnMFto-PF_I,5933
|
|
5
|
+
harbor/events.py,sha256=Q5A9Jqgc3DSsXj5tWBbyctsUE4y-l280i5y4pIDDaN0,20508
|
|
6
|
+
harbor/exceptions.py,sha256=ZuidYNY5rtd4w4f1NHPQVukHnz0nLm53jsSXTpEymw4,367
|
|
7
|
+
harbor/mqtt.py,sha256=ecXgBUsteoD4o5JcEYs9DsclDgUPoBbJBJFtVk6-rfU,19251
|
|
8
|
+
harbor/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
harbor/state.py,sha256=jQDLV8zpkLV2f6zR4LuOtk_B5BtGdp-8dq4NyGZCa-8,1210
|
|
10
|
+
harbor/utils.py,sha256=7A3Tn1aZ93SlxRKY-0b-50ntQL4Pw1j5bXwkJvnarpY,3312
|
|
11
|
+
harbor/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
harbor/data/mqtt_models.py,sha256=OF36ZoUCOeoaKp4TPggM6HCbowgtkH1zLFTozVJUZYY,4314
|
|
13
|
+
harbor/devices/camera.py,sha256=9Rlc11y6aZxEZ7tHgnUJ1r3GVWkkeYdCISC_9MBQHeA,9087
|
|
14
|
+
harbor/devices/monitor.py,sha256=hzx4lu92h3i_34QyYK392gE7CihqERiOZuLhyzDtDk0,452
|
|
15
|
+
harbor_python-1.4.0.dist-info/METADATA,sha256=kLhgfXNCvCfm7bucJz9i4fhXygNNvA6fyxXjijyTq5g,4999
|
|
16
|
+
harbor_python-1.4.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
17
|
+
harbor_python-1.4.0.dist-info/licenses/LICENSE,sha256=QEOXEfrOQetemKy4k1WN5XCApJdpiRtyV5jLMSToVVw,11344
|
|
18
|
+
harbor_python-1.4.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.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
harbor/__init__.py,sha256=F2Yo9T1Hpf0lSioVAk-m8GJnEh1tLd2En4Mzz9RxczY,1606
|
|
2
|
-
harbor/config.py,sha256=LXMDaTC_0Z9wF_vTXJG9C0vQ0XHXo4EuFL0-Kwa4-S4,1373
|
|
3
|
-
harbor/core.py,sha256=Alm6ojRBCibsQ5xGGyaAOQimi-_kE6Q6fuS2ZAxzaNM,3468
|
|
4
|
-
harbor/device.py,sha256=YvaFWieXJ-EzQJU8VQo_ZERl65CynITTAnMFto-PF_I,5933
|
|
5
|
-
harbor/events.py,sha256=4Y3JT_NP1x8rUR7U6n2-LvAENt9zpqD4jVy28AAYo4Q,20400
|
|
6
|
-
harbor/mqtt.py,sha256=43QzJrocLGBWNad7uH4mSm2M9YR15xtmSTvIviwrkXA,16832
|
|
7
|
-
harbor/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
harbor/state.py,sha256=jQDLV8zpkLV2f6zR4LuOtk_B5BtGdp-8dq4NyGZCa-8,1210
|
|
9
|
-
harbor/utils.py,sha256=7A3Tn1aZ93SlxRKY-0b-50ntQL4Pw1j5bXwkJvnarpY,3312
|
|
10
|
-
harbor/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
harbor/data/mqtt_models.py,sha256=OF36ZoUCOeoaKp4TPggM6HCbowgtkH1zLFTozVJUZYY,4314
|
|
12
|
-
harbor/devices/camera.py,sha256=ciq8ynsAaZgW0CWYjKiJGAZwk04pNz4uYfnsN0GT0O4,8429
|
|
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,,
|
|
File without changes
|
|
File without changes
|