# vermon

> Formerly the t-motion-detector package, now named vermon

Latest version **0.7.10** (published 2019-11-10) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install vermon
pnpm add vermon
yarn add vermon
bun add vermon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.10 |
| Published | 2019-11-10 |
| First published | 2018-10-04 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 23 |
| Unpacked size | 342 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | Tiago Cardoso |
| Maintainers | tcardoso |
| Keywords | server, monitor, iot, raspberry, pi, t-motion-detector, motion |

## Links

- npm: https://www.npmjs.com/package/vermon
- Repository: https://github.com/tcardoso2/vermon
- Homepage: https://github.com/tcardoso2/vermon#readme
- Issues: https://github.com/tcardoso2/vermon/issues
- npm.io page: https://npm.io/package/vermon

## Dependencies (23)

- [log](https://npm.io/package/log.md) ^1.4.0
- [chalk](https://npm.io/package/chalk.md) ^2.3.0
- [onoff](https://npm.io/package/onoff.md) ^1.1.9
- [extend](https://npm.io/package/extend.md) ^3.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [moment](https://npm.io/package/moment.md) ^2.20.1
- [prompt](https://npm.io/package/prompt.md) ^1.0.0
- [tracer](https://npm.io/package/tracer.md) ^0.8.12
- [flatted](https://npm.io/package/flatted.md) ^1.0.2
- [chokidar](https://npm.io/package/chokidar.md) ^1.7.0
- [knockout](https://npm.io/package/knockout.md) ^3.4.2
- [node-cmd](https://npm.io/package/node-cmd.md) ^3.0.0
- [optimist](https://npm.io/package/optimist.md) ^0.6.1
- [readline](https://npm.io/package/readline.md) ^1.3.0
- [commander](https://npm.io/package/commander.md) ^2.13.0
- [detect-rpi](https://npm.io/package/detect-rpi.md) ^1.3.0
- [mock-stdin](https://npm.io/package/mock-stdin.md) ^0.3.1
- [slack-node](https://npm.io/package/slack-node.md) ^0.1.8
- [inquirer-menu](https://npm.io/package/inquirer-menu.md) ^1.0.0
- [node-datetime](https://npm.io/package/node-datetime.md) ^2.1.2
- [node-raspistill](https://npm.io/package/node-raspistill.md) 0.0.10
- [node-slack-upload](https://npm.io/package/node-slack-upload.md) ^1.2.1
- [vermon-core-entities](https://npm.io/package/vermon-core-entities.md) ^0.5.13

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.7.10 (latest) — 2019-11-10
- 0.7.8 — 2019-04-16
- 0.7.7 — 2019-04-11
- 0.7.6 — 2019-04-01
- 0.7.5 — 2019-03-31
- 0.7.4 — 2019-03-31
- 0.7.3 — 2019-03-30
- 0.7.0 — 2019-01-07
- 0.6.17 — 2019-01-03
- 0.6.15 — 2018-11-16
- 0.6.9 — 2018-10-10
- 0.6.8 — 2018-10-10
- 0.6.7 — 2018-10-10
- 0.6.6 — 2018-10-10
- 0.6.5 — 2018-10-09
- … 5 more at https://npm.io/package/vermon/versions

## README

[![NPM info](https://nodei.co/npm/vermon.png?downloads=true)](https://nodei.co/npm/vermon.png?downloads=true)

[![Travis build status](https://travis-ci.org/tcardoso2/vermon.png?branch=master)](https://travis-ci.org/tcardoso2/vermon)
[![dependencies](https://david-dm.org/tcardoso2/vermon.svg)](https://david-dm.org/tcardoso2/tvermon.svg)


[![Unit tests](https://github.com/tcardoso2/vermon/blob/master/badge.svg)](https://github.com/tcardoso2/vermon/blob/master/badge.svg) 

# vermon
A NodeJS Motion detector, initially aimed for Raspberry Pi.
The Motion Detectors detect changes in the Environment and the Notifiers receive the Motion Detectors' event changes.  
NOTE: this code has only been tested in the following Linux OS:
- Raspbian: using Node ARMv7
- OSX: Tests and code runs / works where no real sensors are involved
***
* STEP 1 : Create your config.js file and define the default profile of your app:  
````
profiles = {
  default: {
    Environment: {},
    PIRMotionDetector: {
      pin: 17
    },
    MotionDetector: [{
      name: "MD 1"
    },
    {
      name: "MD 2"
    }],
    SlackNotifier: {
      name: "My Slack channel",
      key: "https://hooks.slack.com/services/<MySlackURL>"
    },
    HighPassFilter: [{
      val : 8,
      applyTo: "MD 1"
    },
    {
      val : 5,
      applyTo: "MD 2"
    }]    
  }
}

exports.profiles = profiles;
exports.default = profiles.default;
````
* STEP 2 : Add your main file  
````
let md = require('t-motion-detector');
let config = new md.Config(__dirname + '/config.js', false);

md.StartWithConfig(config, (e,d,n,f)=>{
  console.log(`Good to go! My environment is ${e}, detectors are ${d}, notifiers ${n} and filters ${f}`);
});
````
### Featured detectors:  
#### PIRMotionDetector  
<img src="files/pir_wiring.png" alt="PIRMotionDetector" width="480"/>  

````
//Sends a Slack message if the PIR sensor detects movement
profiles = {
  default: {
    Environment: {},
    PIRMotionDetector: {
      pin: 4
    },
    SlackNotifier: {
      name: "My Slack channel",
      key: "https://hooks.slack.com/services/<MySlackURL>"
    }
  }
}
exports.profiles = profiles;
exports.default = profiles.default;
````  
#### FileDetector  
<img src="files/icons-files.jpg" alt="FileDetector" width="80"/>  

````
//Sends a Slack message if any file is added, removed or changed in the "photos" folder
profiles = {
  default: {
    Environment: {},
    FileDetector: {
      name: "File Detector",
      path: "photos",
      sendOld: false
    },
    SlackNotifier: {
      name: "My Slack channel",
      key: "https://hooks.slack.com/services/<MySlackURL>"
    }
  }
}
exports.profiles = profiles;
exports.default = profiles.default;
````  

From version 0.3.3 onwards, it is possible to attach a Notifier based on node-raspistill,
RaspistillNotifier, which means you can use your Raspberry pi camera to take pictures when
movement is detected. Here's an example which takes a snapshot once the Raspberry pi detects
movement via the PIRMotionDetector connected to pin 17 (requires a sensor like the Infrared 
motion sensor HC-SR501):
````
let md = require('t-motion-detector');

let env = new md.Entities.Environment();
initialMD = new md.Extensions.PIRMotionDetector(17); //Rpi listens on pin 17 for incoming signals from the PIR sensor
md.Start({
	environment: env,
	initialMotionDetector: initialMD
});

camNotifier = new md.Extensions.RaspistillNotifier();
md.AddNotifier(camNotifier); //Rpi will take a picture if the PIR sensor detects movement
````

***
Unit tests: 
t-motion-detector uses mocha unit tests to test the detector, notifier and environment classes. I'll be adding more on the go. to test use "npm test"

## Links
  - [ChangeLog](https://github.com/tcardoso2/vermon/blob/master/CHANGELOG.md)  
  - [Documentation](https://github.com/tcardoso2/vermon/blob/master/DOCUMENTATION.md) 
  - [Code of Conduct](https://github.com/tcardoso2/vermon/blob/master/CODE_OF_CONDUCT.md)   
  - [Related Packages](https://www.npmjs.com/package/t-motion-detector-433)  
  - [Roadmap (Work in Progress)](https://github.com/tcardoso2/vermon/blob/master/ROADMAP.md)

---
_Source: https://npm.io/package/vermon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
