|
1 | 1 | # Web Cam Access via HTTP REST-API
|
2 | 2 |
|
3 | 3 | A Python3 library that unified acess to various web cams with integrated HTTP servers.
|
| 4 | +The intended use is for connecting cameras with built-in REST servers to the |
| 5 | +[home-assistant](https://www.home-assistant.io/) platform. |
4 | 6 |
|
5 | 7 | ## Installation
|
6 | 8 | ### libhttpcam
|
@@ -31,97 +33,92 @@ Currently, only `Foscam` and `Wansview` cameras are supported.
|
31 | 33 | - Wansview Q3S (X Series)
|
32 | 34 |
|
33 | 35 | ## API
|
34 |
| -#### createCam(brand:str, ip:str, port:int=None) -> (HttpCam, int) |
| 36 | +- `createCam(brand:str, ip:str, port:int=None) -> (HttpCam, int)`<br> |
35 | 37 | creates a HttpCam instance for the supplied `brand`, `ip` address, and `port`.
|
36 | 38 | If `port` is omitted, the camera brand's default port will be used.
|
37 | 39 |
|
38 | 40 | returns the camera instance and the port used as a tuple
|
39 | 41 |
|
40 |
| -### Device API |
41 |
| -#### Cam(brand, host, port) |
42 |
| -Constructor; typically does not get called directly but via the `createCam` function |
43 |
| - |
44 | 42 |
|
45 | 43 | ### Device Properties
|
46 |
| -#### brand |
| 44 | +- `brand()`<br> |
47 | 45 | returns the camera instance's brand
|
48 | 46 |
|
49 |
| -#### model: |
| 47 | +- `model()`<br> |
50 | 48 | returns the camera instance's model
|
51 | 49 | Note: for `Wansview` cameras this call returns `'unknown'`
|
52 | 50 |
|
53 |
| -#### host |
| 51 | +- `host()`<br> |
54 | 52 | returns the camera instance's ip address
|
55 | 53 |
|
56 |
| -#### port |
| 54 | +- `port()`<br> |
57 | 55 | returns the camera instance's port
|
58 | 56 |
|
59 |
| - |
60 | 57 | ### Device Configuration
|
61 |
| -#### set_credentials(user='', password='') |
| 58 | +- `set_credentials(user='', password='')`<br> |
62 | 59 | sets the credentials used to access the camera.
|
63 | 60 |
|
64 |
| -#### set_sensitivities(motion=0, audio=0) |
| 61 | +- `set_sensitivities(motion=0, audio=0)`<br> |
| 62 | + |
65 | 63 | Sets the sensitivities for motion detection and audio detection. Both take values between 0 (off) and 100 (sensitive).
|
66 | 64 |
|
67 |
| -#### async_reboot(self) -> Response: |
| 65 | +- `async_reboot(self) -> Response`<br> |
68 | 66 | reboots the camera.
|
69 | 67 |
|
70 |
| -#### async_set_system_time(self) -> Response: |
| 68 | +- `async_set_system_time(self) -> Response`<br> |
71 | 69 | sets the current local time on the camera. This is used for overlays in the snapshots and feeds.
|
72 | 70 |
|
73 |
| -#### async_set_irled(self, status: Status) -> Response: |
| 71 | +- `async_set_irled(self, status: Status) -> Response`<br> |
74 | 72 | sets the status of the active infrared light on the camera. Valid settings are `Status.ON', `Status.OFF`, and `Status.AUTO`
|
75 | 73 |
|
76 |
| -#### async_set_night_mode(self, status: Status) -> Response: |
| 74 | +- `async_set_night_mode(self, status: Status) -> Response`<br> |
77 | 75 | sets the status of the passive infrered sensor. Valid settings are `Status.ON', `Status.OFF`, and `Status.AUTO`
|
78 | 76 |
|
79 |
| -#### async_set_ftp_config(self, server, port, user, passwd) -> Response: |
| 77 | +- `async_set_ftp_config(self, server, port, user, passwd) -> Response`<br> |
80 | 78 | configures the ftp client to allow snapshots and recordings to be stored on a server via FTP.
|
81 | 79 |
|
82 |
| -#### async_set_audio_volumes(self, audio_in=50, audio_out=50) -> Response: |
| 80 | +- `async_set_audio_volumes(self, audio_in=50, audio_out=50) -> Response`<br> |
83 | 81 | configures audio volumes for the camera:
|
84 | 82 | - audio_in: microphone volume
|
85 | 83 | - audio_out: speaker and alert volume
|
86 | 84 |
|
87 | 85 | ### Device Queries
|
88 |
| -#### async_get_model(self) -> str: |
| 86 | +- `async_get_model(self) -> str`<br> |
89 | 87 | queries and returns the brand's model number as a string
|
90 | 88 |
|
91 |
| -#### async_get_night_mode(self) -> IRmode: |
| 89 | +- `async_get_night_mode(self) -> IRmode`<br> |
92 | 90 | queries and returns the sensor night mode setting:
|
93 |
| -- bool result.LED |
94 |
| -- bool result.Sensor |
| 91 | + - bool result.LED |
| 92 | + - bool result.Sensor |
95 | 93 |
|
96 |
| -#### async_get_alarm_trigger(self) -> Trigger: |
| 94 | +- `async_get_alarm_trigger(self) -> Trigger`<br> |
97 | 95 | queries and returns the alarm trigger setting:
|
98 |
| -- bool result.motion |
99 |
| -- bool result.audio |
| 96 | + - bool result.motion |
| 97 | + - bool result.audio |
100 | 98 |
|
101 |
| -#### async_get_alarm_action(self) -> Action: |
| 99 | +- `async_get_alarm_action(self) -> Action`<br> |
102 | 100 | queries and returns the alarm action setting:
|
103 |
| -- bool result.audio - sound the siren |
104 |
| -- bool result.ftp_snap - store snapshots to FTP server |
105 |
| -- bool result.ftp_rec - store recordings to FTP server |
106 |
| - |
107 |
| -#### async_get_alarm_triggered(self) -> bool: |
108 |
| -queries and returns `True` if an alram was detected. |
| 101 | + - bool result.audio - sound the siren |
| 102 | + - bool result.ftp_snap - store snapshots to FTP server |
| 103 | + - bool result.ftp_rec - store recordings to FTP server |
109 | 104 |
|
| 105 | +- `async_get_alarm_triggered(self) -> bool`<br> |
| 106 | +queries and returns `True` if an alram was detected.<br> |
110 | 107 | *Currently not implemented, returns `False`*
|
111 | 108 |
|
112 |
| -#### async_get_ftp_config(self): |
| 109 | +- `async_get_ftp_config(self)`<br> |
113 | 110 | queries and returns the current FTP configuration
|
114 | 111 |
|
115 | 112 |
|
116 | 113 | ### Device Actions
|
117 |
| -#### async_snap_picture(self): |
| 114 | +- `async_snap_picture(self)`<br> |
118 | 115 | snaps a picture and returns the byte array
|
119 | 116 |
|
120 |
| -#### async_mjpeg_stream(self, request): |
| 117 | +- `async_mjpeg_stream(self, request)`<br> |
121 | 118 | requests and returns a motion JPEG stream
|
122 | 119 |
|
123 |
| -#### async_set_alarm(self, trigger: Trigger, action: Action) -> Response: |
| 120 | +- `async_set_alarm(self, trigger: Trigger, action: Action) -> Response`<br> |
124 | 121 | Arms or disarms the camera by7 setting the `trigger` and `action` settings
|
125 | 122 |
|
126 |
| -#### async_ptz_preset(self, preset_pos:int): |
| 123 | +- `async_ptz_preset(self, preset_pos:int)`<br> |
127 | 124 | moves the camera to the specified preprogrammed position if PTX is available
|
0 commit comments