github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/content/en/docs/plugins/onvif.md (about) 1 2 --- 3 title: "Onvif" 4 linkTitle: "onvif" 5 date: 2024-01-04 6 description: > 7 8 --- 9 10 The Smart Home project provides the ONVIF plugin, enabling interaction with surveillance cameras using the ONVIF protocol. This plugin implements several JavaScript methods for camera control and snapshot retrieval. 11 12 #### JavaScript Methods 13 14 1. **`Camera.continuousMove(X, Y)`**: This method allows for smooth camera movement to the specified coordinates X and Y. 15 16 2. **`Camera.stopContinuousMove()`**: This method stops continuous camera movement. 17 18 3. **`OnvifGetSnapshotUri(entityId)`**: Method for obtaining the snapshot URI for the specified device identifier. 19 20 4. **`DownloadSnapshot(entityId)`**: Method for downloading a snapshot from the device based on its identifier. 21 22 #### Device Status 23 24 - **`motion` (type: Boolean)**: Status indicating the presence of motion detected by the surveillance camera. 25 26 #### Device Settings 27 28 - **`address` (type: String)**: IP address of the surveillance camera. 29 30 - **`onvifPort` (type: Int)**: Port for connecting to the camera via the ONVIF protocol. 31 32 - **`rtspPort` (type: Int)**: Port for video transmission via the RTSP protocol. 33 34 - **`userName` (type: String)**: User name for authentication when accessing the camera. 35 36 - **`password` (type: Encrypted)**: Encrypted password for authentication. 37 38 - **`requireAuthorization` (type: Bool)**: Flag indicating whether authorization is required for interacting with the camera. 39 40 #### Control Commands 41 42 - **`continuousMove`**: Command to initiate continuous camera movement. 43 44 - **`stopContinuousMove`**: Command to stop continuous camera movement. 45 46 #### Device Statuses 47 48 - **`connected`**: The device is successfully connected and ready to operate. 49 50 - **`offline`**: The device is unavailable or disconnected from the system. 51 52 These functions allow the integration of surveillance cameras into the Smart Home system and efficient management through the ONVIF plugin. 53 54 Example of using the "onvif" plugin to implement camera control: 55 56 ```javascript 57 continuousMove = function (args) { 58 var X, Y; 59 X = args['X'] || 0; 60 Y = args['Y'] || 0; 61 if (Math.abs(X) > Math.abs(Y)) { 62 Y = 0; 63 } else { 64 X = 0; 65 } 66 return Camera.continuousMove(X, Y); 67 }; 68 69 stopStop = function (args) { 70 return Camera.stopContinuousMove(); 71 }; 72 73 ```