limitless-pushbullet
Advanced tools
Comparing version 1.0.1 to 1.1.0
28
index.js
@@ -16,2 +16,3 @@ var Pushbullet = require('pushbullet'); | ||
.alias('r', 'grace-period') | ||
.alias('c', 'color') | ||
.describe('p', 'Pushbullet API key') | ||
@@ -24,2 +25,3 @@ .describe('m', 'Milight IP address') | ||
.describe('r', 'How many seconds to wait after one blink') | ||
.describe('c', 'Color (0-256) 0 is purple, 27 is red, 186 is blue. Counter-clockwise of the color pallete on your remote') | ||
.argv; | ||
@@ -76,3 +78,3 @@ | ||
if (gracePeriod && +new Date() - lastTime <= gracePeriod * 1000) { | ||
if (enabled && gracePeriod && +new Date() - lastTime <= gracePeriod * 1000) { | ||
enabled = false; | ||
@@ -83,3 +85,3 @@ } else { | ||
if (fileLocation) { | ||
if (enabled && fileLocation) { | ||
promise = promise.then(function () { return readFile(fileLocation, { encoding: 'utf-8' }) }).then(function (data) { | ||
@@ -94,6 +96,24 @@ enabled = !parseInt(data.replace(/(\r\n|\n|\r)/gm,'').trim()); | ||
var color = argv.c; // white | ||
if (color && data.application_name) { | ||
var lcAppName = data.application_name.toLowerCase(); | ||
if (lcAppName.indexOf('inbox') >= 0) { | ||
color -= 30; | ||
color += color < 0 ? 256 : 0; | ||
} else if (lcAppName.indexOf('whatsapp') >= 0) { | ||
color = (color + 30) % 255; | ||
} | ||
} | ||
milight.sendCommands(Commands.rgbw.on(group), Commands.rgbw.brightness(20)); | ||
milight.pause(500); | ||
milight.sendCommands(Commands.rgbw.on(group), Commands.rgbw.brightness(100)); | ||
color && milight.pause(500); | ||
color && milight.sendCommands(Commands.rgbw.hue(color)); | ||
color && milight.sendCommands(Commands.rgbw.brightness(10)); | ||
color && milight.sendCommands(Commands.rgbw.brightness(100)); | ||
milight.pause(250); | ||
color && milight.sendCommands(Commands.rgbw.brightness(10)); | ||
color && milight.pause(500); | ||
color && milight.sendCommands(Commands.rgbw.whiteMode(group)); | ||
milight.sendCommands(Commands.rgbw.brightness(100)); | ||
}); | ||
}); |
{ | ||
"name": "limitless-pushbullet", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Use this app to make your LimitlessLED / MiLight blink when you receive a pushbullet notification", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16686
101