Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baudev/motion-project-api
API for https://motion-project.github.io/
https://github.com/baudev/motion-project-api
api motion motion-project typescript
Last synced: about 1 month ago
JSON representation
API for https://motion-project.github.io/
- Host: GitHub
- URL: https://github.com/baudev/motion-project-api
- Owner: baudev
- License: apache-2.0
- Created: 2020-03-19T11:29:35.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-25T11:15:39.000Z (over 2 years ago)
- Last Synced: 2024-09-30T08:22:31.577Z (about 2 months ago)
- Topics: api, motion, motion-project, typescript
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Motion API
This library aims to expose a simplistic API for the https://motion-project.github.io/ project.
# Installation
```
npm i motion-project-api
```# Usage
Example creating a snapshot with the camera 1.
```typescript
let motionApi = new MotionApi("http://localhost:7999"); // URL of the motion web server
motionApi.getCamera(1).createSnapshot(); // creates a snapshot for the camera 1
```## API
### Class MotionApi
**MotionApi(apiUrl)**
+ apiUrl - (_string_) The motion web server url.
**getCamera(idCamera): Camera**
+ idCamera - (_number_) The camera number to control.
Returns an instance of `Camera`.
### Class Camera
**Camera(id)**
+ id - (_number_) The camera number to control.
**getConfigList(): Promise\**
Lists all the configuration values for the camera.
**setConfig(parm, value1): Promise\**
+ parm - (_string_) Name of the parameter
+ value1 - (_string_) New value of the specified parameterSet the value for the requested parameter.
**getConfig(parm): Promise\**
+ parm - (_string_) The name of the parameter
Return the value currently set for the parameter.
**writeConfig(): Promise\**
Write the current parameters to the file.
**getDetectionStatus(): Promise\**
Return the current status of the camera. `MotionDetectionStatus.ENABLE` is enable or `MotionDetectionStatus.DISABLE` if disabled.
**getConnectionStatus(): Promise\**
Return the connection status of the camera. `MotionConnectionStatus.OK` if well connected otherwise `MotionConnectionStatus.DISCONNECTED`.
**startDetection(): Promise\**
Start or resume motion detection.
**pauseDetection(): Promise\**
Pause the motion detection. _When the action of pause is executed, Motion will stop the motion detection processing and of course all events but will continue to process and decode images from the camera. This allows for a faster transition when the user executes a start._
**startEvent(): Promise\**
Trigger a new event.
**endEvent(): Promise\**
Trigger the end of a event.
**createSnapshot(): Promise\**
Create a snapshot
**restart(): Promise\**
Shutdown and restart Motion.
**quit(): Promise\**
Close all connections to the camera. _The quit action conversely not only stops the motion detection but also disconnects from the camera and decoding of images. To start motion detection after a quit, the user must execute a restart which will reinitialize the connection to the camera. And since the camera was completely disconnect, it can take more than a few seconds for Motion to fully start and have the camera available for processing or viewing._
**end(): Promise\**
Entirely shutdown the Motion application. _This option completely terminates the Motion application. It closes all connections to all the cameras and terminates the application. This may be required when running Motion in daemon mode. Note that there is no way to restart the Motion application from the webcontrol interface after processing a end request._