Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Room Name support #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ It can also receive webhooks sent by location-aware mobile apps (such as [Locati
| `anyoneSensor` | optional, default: true |
| `nooneSensor` | optional, default: false |
| `webhookPort` | optional, default: 51828 |
| `roomName` | optional, add a room name to AnyOne and No One sensors, default: "" |

| `cacheDirectory` | optional, default: "./.node-persist/storage" |
| `pingInterval` | optional, in milliseconds, default: 10000, if set to -1 than the ping mechanism will not be used |
| `ignoreReEnterExitSeconds` | optional, in minutes, default: 0, if set to 0 than every enter/exit will trigger state change otherwise the state will only change if no re-enter/exit occurs in specified number of seconds |
Expand Down
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ function PeoplePlatform(log, config){
this.pingInterval = config["pingInterval"] || 10000;
this.ignoreReEnterExitSeconds = config["ignoreReEnterExitSeconds"] || 0;
this.people = config['people'];
this.roomName = config["roomName"] || "";
this.storage = require('node-persist');
this.storage.initSync({dir:this.cacheDirectory});
this.webhookQueue = [];

if (this.roomName) {
SENSOR_ANYONE = 'Anyone' + " @ " + this.roomName;
SENSOR_NOONE = 'No One' + " @ " + this.roomName;
} else {
SENSOR_ANYONE = 'Anyone';
SENSOR_NOONE = 'No One';
}
}

PeoplePlatform.prototype = {
Expand Down