├── .gitignore
├── .travis.yml
├── DEVELOPERS.md
├── Gruntfile.js
├── LICENSE.md
├── README.md
├── app.js
├── apps
├── announce3dPrinter.js
├── announceActiveBuilding.js
├── announceAirQuality.js
├── announceDLinkCamera.js
├── announceFoscam.js
├── announceGeiger.js
├── announceGithub.js
├── announceMoisture.js
├── announceNest.js
├── announcePresence.js
├── announceRss.js
├── announceStateChange.js
├── announceStocks.js
├── announceTravis.js
├── announceTrendingNews.js
├── conditional
│ ├── airFilterWhenSmoggy.js
│ ├── blindsWindowOpen.js
│ └── nestWindowOpen.js
├── dLinkCameraChange.js
├── dLinkCameraDvr.js
├── dogWalkReminder.js
├── doorKnock.js
├── foscamChange.js
├── foscamDvr.js
├── gerty.js
├── gerty
│ ├── activeBuilding.js
│ ├── ai.js
│ ├── airQuality.js
│ ├── blinds.js
│ ├── entertainment.js
│ ├── language.js
│ ├── mood.js
│ ├── nest.js
│ ├── runCommand.js
│ ├── security.js
│ ├── smartthings.js
│ ├── stereo.js
│ ├── stocks.js
│ ├── travis.js
│ ├── tv.js
│ ├── vacuum.js
│ └── weather.js
├── hallLightHome.js
├── homeWatch.js
├── nestChange.js
├── presenceMode.js
├── safeWatch.js
├── smartthingsModeChange.js
├── smartthingsSwitchSync.js
├── sunPhase.js
├── switchControlsOutlet.js
├── twitterCommand.js
└── windowOpen.js
├── bin
└── switchBoard
├── cache
├── .gitignore
├── db
│ └── .gitignore
└── version.txt
├── config
└── config.js
├── css
├── combo.min.css
├── common.css
└── font-awesome.css
├── devices
├── activeBuilding
│ ├── controller.js
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── airQuality
│ ├── controller.js
│ ├── fragments
│ │ ├── graph.tpl
│ │ └── report.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── chromecast
│ ├── controller.js
│ └── template.tpl
├── clientMp3
│ ├── controller.js
│ └── template.tpl
├── clientNotify
│ ├── controller.js
│ └── template.tpl
├── clientScreenSaver
│ ├── controller.js
│ └── template.tpl
├── clientSpeech
│ ├── controller.js
│ └── template.tpl
├── clientVibrate
│ ├── controller.js
│ └── template.tpl
├── dLinkCamera
│ ├── controller.js
│ ├── fragments
│ │ ├── photo.tpl
│ │ ├── photos.tpl
│ │ ├── thumb.tpl
│ │ ├── video.tpl
│ │ └── videos.tpl
│ ├── parser.js
│ └── template.tpl
├── debug
│ ├── controller.js
│ ├── parser.js
│ └── template.tpl
├── denon
│ ├── controller.js
│ ├── parser.js
│ └── template.tpl
├── enviro
│ ├── controller.js
│ ├── fragments
│ │ ├── graph.tpl
│ │ ├── low.tpl
│ │ ├── optimum.tpl
│ │ └── report.tpl
│ ├── parser.js
│ └── template.tpl
├── foscam
│ ├── controller.js
│ ├── fragments
│ │ ├── photo.tpl
│ │ ├── photos.tpl
│ │ ├── thumb.tpl
│ │ ├── video.tpl
│ │ └── videos.tpl
│ ├── parser.js
│ └── template.tpl
├── geiger
│ ├── controller.js
│ ├── fragments
│ │ ├── graph.tpl
│ │ └── report.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── gerty
│ ├── controller.js
│ ├── fragments
│ │ └── comment.tpl
│ ├── parser.js
│ └── template.tpl
├── github
│ ├── controller.js
│ ├── fragments
│ │ ├── commit.tpl
│ │ └── message.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── haveibeenpwned
│ ├── controller.js
│ ├── fragments
│ │ ├── allClear.tpl
│ │ ├── pwn.tpl
│ │ └── pwns.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── lg
│ ├── controller.js
│ └── template.tpl
├── location
│ ├── controller.js
│ ├── fragments
│ │ └── location.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── monoPrice3dPrinter
│ ├── controller.js
│ ├── parser.js
│ └── template.tpl
├── mp3
│ ├── controller.js
│ └── template.tpl
├── neato
│ ├── controller.js
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── nest
│ ├── controller.js
│ ├── fragments
│ │ ├── nestGroups.tpl
│ │ ├── nestProtect.tpl
│ │ └── nestThermostat.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── octoprint
│ ├── controller.js
│ ├── fragments
│ │ └── video.tpl
│ ├── parser.js
│ └── template.tpl
├── panasonic
│ ├── controller.js
│ └── template.tpl
├── piHole
│ ├── controller.js
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── pioneer
│ ├── controller.js
│ └── template.tpl
├── powerView
│ ├── controller.js
│ ├── fragments
│ │ ├── blind.tpl
│ │ ├── blinds.tpl
│ │ ├── scene.tpl
│ │ └── scenes.tpl
│ ├── parser.js
│ └── template.tpl
├── ps3
│ ├── controller.js
│ └── template.tpl
├── pushover
│ ├── controller.js
│ └── template.tpl
├── raspberryRemote
│ ├── controller.js
│ ├── fragments
│ │ └── raspberryRemote.tpl
│ ├── parser.js
│ └── template.tpl
├── roku
│ ├── controller.js
│ ├── fragments
│ │ └── roku.tpl
│ ├── parser.js
│ └── template.tpl
├── rss
│ ├── controller.js
│ ├── fragments
│ │ └── rss.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── samsung
│ ├── controller.js
│ └── template.tpl
├── smartthings
│ ├── controller.js
│ ├── fragments
│ │ ├── smartthingsGroups.tpl
│ │ ├── smartthingsListAction.tpl
│ │ └── smartthingsListStatic.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── sms
│ ├── controller.js
│ └── template.tpl
├── speech
│ ├── controller.js
│ └── template.tpl
├── sports
│ ├── controller.js
│ ├── fragments
│ │ ├── game.tpl
│ │ ├── image.tpl
│ │ └── league.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── tcl
│ ├── controller.js
│ ├── parser.js
│ └── template.tpl
├── traffic
│ ├── controller.js
│ ├── fragments
│ │ └── traffic.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── travis
│ ├── controller.js
│ ├── fragments
│ │ └── travis.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── twitter
│ ├── controller.js
│ ├── fragments
│ │ └── twitter.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── weather
│ ├── controller.js
│ ├── fragments
│ │ └── weather.tpl
│ ├── parser.js
│ ├── poller.js
│ └── template.tpl
├── website
│ ├── controller.js
│ ├── parser.js
│ └── template.tpl
├── welcome
│ └── template.tpl
├── wemo
│ ├── controller.js
│ ├── fragments
│ │ ├── wemoGroups.tpl
│ │ └── wemoListSwitch.tpl
│ ├── parser.js
│ └── template.tpl
└── xbmc
│ ├── controller.js
│ ├── fragments
│ └── xbmc.tpl
│ ├── parser.js
│ └── template.tpl
├── font
├── fontawesome-webfont.eot
├── fontawesome-webfont.svg
├── fontawesome-webfont.ttf
├── fontawesome-webfont.woff
└── fontawesome-webfont.woff2
├── images
├── dLinkCamera
│ ├── dvr
│ │ └── .gitignore
│ ├── photos
│ │ └── .gitignore
│ └── thumb
│ │ └── .gitignore
├── foscam
│ ├── dvr
│ │ └── .gitignore
│ ├── photos
│ │ └── .gitignore
│ └── thumb
│ │ └── .gitignore
├── icons
│ ├── apple-touch-icon.png
│ └── favicon.ico
├── loading.gif
├── neato
│ └── .gitignore
├── roku
│ └── .gitignore
└── sports
│ └── .gitignore
├── js
├── combo.min.js
├── common.js
└── switchBoard.js
├── lang
├── en.js
└── es-CO.js
├── lib
├── ai.js
├── apps.js
├── auth.js
├── db.js
├── deviceState.js
├── loadController.js
├── loadMarkup.js
├── notify.js
├── requestInit.js
├── runCommand.js
├── schedule.js
├── sharedUtil.js
├── staticAssets.js
├── translate.js
└── webSockets.js
├── manifest.appcache
├── manifest.json
├── mp3
├── attribution.txt
├── bike.mp3
├── boxing.mp3
├── cash.mp3
├── chimes.mp3
├── church.mp3
├── dingDing.mp3
├── doorbell.mp3
├── magic.mp3
├── rooster.mp3
└── songBell.mp3
├── nodemon.json
├── package.json
├── templates
├── 404.html
├── fragments
│ └── navigation.tpl
└── markup.html
└── tests
├── testRunner.js
└── unit
├── apps
├── announceTrendingNews.js
├── dLinkCameraDvr.js
├── foscamDvr.js
└── gerty
│ ├── activeBuilding.js
│ ├── airQuality.js
│ ├── blinds.js
│ ├── entertainment.js
│ ├── language.js
│ ├── mood.js
│ ├── nest.js
│ ├── smartthings.js
│ ├── stereo.js
│ ├── stocks.js
│ ├── travis.js
│ ├── tv.js
│ ├── vacuum.js
│ └── weather.js
├── devices
├── activeBuilding
│ ├── controller.js
│ └── parser.js
├── airQuality
│ ├── controller.js
│ └── parser.js
├── chromecast
│ └── controller.js
├── dLinkCamera
│ ├── controller.js
│ └── parser.js
├── debug
│ └── parser.js
├── denon
│ ├── controller.js
│ └── parser.js
├── enviro
│ ├── controller.js
│ └── parser.js
├── foscam
│ ├── controller.js
│ └── parser.js
├── geiger
│ ├── controller.js
│ └── parser.js
├── gerty
│ ├── controller.js
│ └── parser.js
├── github
│ ├── controller.js
│ └── parser.js
├── haveibeenpwned
│ ├── controller.js
│ └── parser.js
├── lg
│ └── controller.js
├── location
│ ├── controller.js
│ └── parser.js
├── monoPrice3dPrinter
│ ├── controller.js
│ └── parser.js
├── mp3
│ └── controller.js
├── neato
│ ├── controller.js
│ └── parser.js
├── nest
│ ├── controller.js
│ └── parser.js
├── octoprint
│ ├── controller.js
│ └── parser.js
├── panasonic
│ └── controller.js
├── piHole
│ ├── controller.js
│ └── parser.js
├── pioneer
│ └── controller.js
├── powerView
│ ├── controller.js
│ └── parser.js
├── ps3
│ └── controller.js
├── pushover
│ └── controller.js
├── raspberryRemote
│ ├── controller.js
│ └── parser.js
├── roku
│ ├── controller.js
│ └── parser.js
├── rss
│ ├── controller.js
│ └── parser.js
├── samsung
│ └── controller.js
├── smartthings
│ ├── controller.js
│ └── parser.js
├── sms
│ └── controller.js
├── speech
│ └── controller.js
├── sports
│ ├── controller.js
│ └── parser.js
├── tcl
│ ├── controller.js
│ └── parser.js
├── traffic
│ ├── controller.js
│ └── parser.js
├── travis
│ ├── controller.js
│ └── parser.js
├── twitter
│ ├── controller.js
│ └── parser.js
├── weather
│ ├── controller.js
│ └── parser.js
├── website
│ └── parser.js
├── wemo
│ ├── controller.js
│ └── parser.js
└── xbmc
│ ├── controller.js
│ └── parser.js
├── js
└── combo.min.js
└── lib
├── ai.js
├── auth.js
├── db.js
├── deviceState.js
├── loadController.js
├── loadMarkup.js
├── requestInit.js
├── runCommand.js
├── schedule.js
├── sharedUtil.js
├── staticAssets.js
└── translate.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: false
3 | before_install:
4 | - export TZ=America/Los_Angeles
5 | node_js:
6 | - "node"
7 | - "lts/*"
8 | - "13"
9 | - "12"
10 | - "11"
11 | - "10"
12 | - "9"
13 | - "8"
14 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 brian@bevey.org
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to
5 | deal in the Software without restriction, including without limitation the
6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 | sell copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 | IN THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/apps/announce3dPrinter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Announce when your 3d printer is finished.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | var PrintProgress = {};
32 |
33 | return {
34 | version : 20171220,
35 |
36 | translate : function (token, lang) {
37 | var translate = require(__dirname + '/../lib/translate');
38 |
39 | return translate.translate('{{i18n_' + token + '}}', 'monoPrice3dPrinter', lang);
40 | },
41 |
42 | announce3dPrinter : function (deviceId, command, controllers, values) {
43 | var notify,
44 | lang = controllers.config.language,
45 | message = '',
46 | percent;
47 |
48 | if ((values) && (values.value)) {
49 | percent = values.value.percent;
50 |
51 | if ((PrintProgress[deviceId] !== percent) && (percent === 100)) {
52 | notify = require(__dirname + '/../lib/notify');
53 |
54 | message = this.translate('PRINT_COMPLETED', lang);
55 |
56 | notify.notify(message, controllers, deviceId);
57 | }
58 |
59 | PrintProgress[deviceId] = percent;
60 | }
61 | }
62 | };
63 | }());
64 |
--------------------------------------------------------------------------------
/apps/announceFoscam.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Announce when the camera is armed.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20190312,
33 |
34 | announceFoscam : function (deviceId, command, controllers) {
35 | var translate = require(__dirname + '/../lib/translate'),
36 | deviceState = require(__dirname + '/../lib/deviceState'),
37 | notify = require(__dirname + '/../lib/notify'),
38 | currentState = deviceState.getDeviceState(deviceId),
39 | message = '';
40 |
41 | if ((currentState) && (currentState.value)) {
42 | if ((command === 'ALARM_ON') || (command === 'ALARM_OFF')) {
43 | if ((command === 'ALARM_ON') && (currentState.value.alarm === 'off')) {
44 | message = translate.translate('{{i18n_CAMERA_ARMED}}', 'foscam', controllers.config.language);
45 | }
46 |
47 | else if ((command === 'ALARM_OFF') && (currentState.value.alarm === 'on')) {
48 | message = translate.translate('{{i18n_CAMERA_DISARMED}}', 'foscam', controllers.config.language);
49 | }
50 |
51 | if (message) {
52 | notify.notify(message.split('{{CAMERA}}').join(controllers[deviceId].config.title), controllers, deviceId);
53 | }
54 | }
55 | }
56 | }
57 | };
58 | }());
59 |
--------------------------------------------------------------------------------
/apps/announceMoisture.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Announce and push notification when a SmartThings moisture
26 | * sensor has gone off.
27 | */
28 |
29 | module.exports = (function () {
30 | 'use strict';
31 |
32 | return {
33 | version : 20161101,
34 |
35 | announceMoisture : function (deviceId, command, controllers) {
36 | var translate = require(__dirname + '/../lib/translate'),
37 | notify = require(__dirname + '/../lib/notify'),
38 | message = '',
39 | value;
40 |
41 | if (command.indexOf('subdevice-state-moisture-') === 0) {
42 | command = command.split('subdevice-state-moisture-').join('');
43 | value = command.split('-');
44 | command = value[0];
45 | value = value[1];
46 |
47 | if (value === 'on') {
48 | message = translate.translate('{{i18n_WATER_DETECTED}}', 'smartthings', controllers.config.language).replace('{{LABEL}}', command);
49 | }
50 |
51 | if (message) {
52 | notify.notify(message, controllers, deviceId);
53 | }
54 | }
55 | }
56 | };
57 | }());
58 |
--------------------------------------------------------------------------------
/apps/announceTravis.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview If the latest build is failing, send a Desktop Notification.
26 | * As build failures are not always terrible (such as a pending
27 | * pull request), we don't want to send an annoying notification
28 | * via SMS, push or text.
29 | */
30 |
31 | module.exports = (function () {
32 | 'use strict';
33 |
34 | return {
35 | version : 20161101,
36 |
37 | announceTravis : function (deviceId, command, controllers, values) {
38 | var notify,
39 | translate;
40 |
41 | if ((values.value) && (values.value[0]) && (values.value[0].state === 'finished') && (values.value[0].status === 'err')) {
42 | notify = require(__dirname + '/../lib/notify');
43 | translate = require(__dirname + '/../lib/translate');
44 |
45 | notify.notify(translate.translate('{{i18n_BUILD_FAILURE}}', 'travis', controllers.config.language), controllers, deviceId);
46 | }
47 | }
48 | };
49 | }());
50 |
--------------------------------------------------------------------------------
/apps/dLinkCameraChange.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview When the DLink camera is armed or disarmed, we want to wait a
26 | * very short time to allow the new setting to be registered on
27 | * the device - then grab the new state instead of waiting for the
28 | * next scheduled state.
29 | */
30 |
31 | module.exports = (function () {
32 | 'use strict';
33 |
34 | return {
35 | version : 20181205,
36 |
37 | dLinkCameraChange : function (deviceId, command, controllers) {
38 | var runCommand = require(__dirname + '/../lib/runCommand');
39 |
40 | if ((command === 'ALARM_ON') || (command === 'ALARM_OFF')) {
41 | // We want to grab the state from the source of truth (the actual
42 | // device), but we need to wait a short time for it to register.
43 | setTimeout(function () {
44 | console.log('\x1b[35m' + controllers[deviceId].config.title + '\x1b[0m: Fetching alarm state');
45 |
46 | runCommand.runCommand(deviceId, 'state', 'single', false);
47 | }, 250);
48 | }
49 | }
50 | };
51 | }());
52 |
--------------------------------------------------------------------------------
/apps/foscamChange.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview When the foscam is armed or disarmed, we want to wait a very
26 | * short time to allow the new setting to be registered on the
27 | * device - then grab the new state instead of waiting for the
28 | * next scheduled state.
29 | */
30 |
31 | module.exports = (function () {
32 | 'use strict';
33 |
34 | return {
35 | version : 20161101,
36 |
37 | foscamChange : function (deviceId, command, controllers) {
38 | var runCommand = require(__dirname + '/../lib/runCommand');
39 |
40 | if ((command === 'ALARM_ON') || (command === 'ALARM_OFF')) {
41 | // We want to grab the state from the source of truth (the actual
42 | // device), but we need to wait a short time for it to register.
43 | setTimeout(function () {
44 | console.log('\x1b[35m' + controllers[deviceId].config.title + '\x1b[0m: Fetching alarm state');
45 |
46 | runCommand.runCommand(deviceId, 'state', 'single', false);
47 | }, 500);
48 | }
49 | }
50 | };
51 | }());
52 |
--------------------------------------------------------------------------------
/apps/gerty/activeBuilding.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on active building package status.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var excited = state.value ? (state.value.length * 2) : 0;
34 |
35 | return { excited : excited };
36 | }
37 | };
38 | }());
39 |
--------------------------------------------------------------------------------
/apps/gerty/blinds.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on Blinds interactions.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var entertained = 0,
34 | blind = 0,
35 | blinds = 0,
36 | device,
37 | i = 0;
38 |
39 | if ((state) && (state.value) && (state.value.devices)) {
40 | for (i; i < state.value.devices.length; i += 1) {
41 | device = state.value.devices[i];
42 |
43 | if (device.state) {
44 | blind += device.state;
45 | blinds += 1;
46 | }
47 | }
48 | }
49 |
50 | if (blinds) {
51 | // I like having the blinds open, usually.
52 | if (blind / blinds > 80) {
53 | entertained += 2;
54 | }
55 | }
56 |
57 | return { entertained : entertained };
58 | }
59 | };
60 | }());
61 |
--------------------------------------------------------------------------------
/apps/gerty/entertainment.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on entertainment devices.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var entertained = state.state === 'err' ? 0 : 4;
34 |
35 | return { entertained : entertained };
36 | }
37 | };
38 | }());
39 |
--------------------------------------------------------------------------------
/apps/gerty/security.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on camera devices.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var scared = state.value === 'off' ? 0 : -2;
34 |
35 | return { scared : scared };
36 | }
37 | };
38 | }());
39 |
--------------------------------------------------------------------------------
/apps/gerty/stereo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on stereo devices.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var entertained = state.state === 'err' ? 0 : 1;
34 |
35 | return { entertained : entertained };
36 | }
37 | };
38 | }());
39 |
--------------------------------------------------------------------------------
/apps/gerty/stocks.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on stocks.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var excited = 0,
34 | scared = 0,
35 | stock,
36 | change = 0,
37 | i = 0;
38 |
39 | if ((state) && (state.value)) {
40 | // Collect an average of all current sotck movement for the day.
41 | for (stock in state.value) {
42 | if (state.value[stock].dayChangePercent) {
43 | change += parseFloat(state.value[stock].dayChangePercent.replace('%', ''));
44 | i += 1;
45 | }
46 | }
47 |
48 | if (i) {
49 | excited = change / i;
50 |
51 | if (excited < 0) {
52 | scared = excited;
53 | }
54 |
55 | // We'll limit the amount of excitement (or lack thereof).
56 | if (excited > 5) {
57 | excited = 5;
58 | }
59 |
60 | else if (excited < -5) {
61 | excited = -5;
62 | scared = -5;
63 | }
64 | }
65 | }
66 |
67 | return { excited : excited, scared : scared };
68 | }
69 | };
70 | }());
71 |
--------------------------------------------------------------------------------
/apps/gerty/travis.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on Travis CI.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var scared = 0;
34 |
35 | if ((state) && (state.values) && (state.values.value) && (state.values.value.length)) {
36 | if (state.values.value[0].status === 'err') {
37 | scared = -3;
38 | }
39 | }
40 |
41 | return { scared : scared };
42 | }
43 | };
44 | }());
45 |
--------------------------------------------------------------------------------
/apps/gerty/tv.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on TV devices.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var entertained = state.state === 'err' ? 0 : 3;
34 |
35 | return { entertained : entertained };
36 | }
37 | };
38 | }());
39 |
--------------------------------------------------------------------------------
/apps/gerty/vacuum.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Execute Gerty commands based on stocks.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | mood : function (state) {
33 | var comfortable = 0;
34 |
35 | if ((state) && (state.value)) {
36 | if (state.value.docked === false) {
37 | comfortable = -1;
38 | }
39 | }
40 |
41 | return { comfortable : comfortable };
42 | }
43 | };
44 | }());
45 |
--------------------------------------------------------------------------------
/apps/nestChange.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview When a command is issued to the Nest, we'll want to wait a
26 | * short while, then explicitly grab the state from the API to
27 | * ensure the state is correct.
28 | */
29 |
30 | module.exports = (function () {
31 | 'use strict';
32 |
33 | return {
34 | version : 20161101,
35 |
36 | nestChange : function (deviceId, command) {
37 | var runCommand = require(__dirname + '/../lib/runCommand');
38 |
39 | if (command !== 'LIST') {
40 | // We want to grab the state from the source of truth (the actual
41 | // API), but we need to wait a short time for it to register.
42 | setTimeout(function () {
43 | runCommand.runCommand(deviceId, 'list', deviceId, false);
44 | }, 1000);
45 | }
46 | }
47 | };
48 | }());
49 |
--------------------------------------------------------------------------------
/bin/switchBoard:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | 'use strict';
4 |
5 | process.title = 'switchBoard';
6 | require('../app.js');
7 |
--------------------------------------------------------------------------------
/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 | !db
4 | !version.txt
5 |
--------------------------------------------------------------------------------
/cache/db/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/cache/version.txt:
--------------------------------------------------------------------------------
1 | 1614193538262
--------------------------------------------------------------------------------
/devices/activeBuilding/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On poll, check the ActiveBuilding package state.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/activeBuilding/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/airQuality/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20171207,
33 |
34 | /**
35 | * On long interval, poll the OpenAQ API for the latest report.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/airQuality/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/devices/clientMp3/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | module.exports = (function () {
24 | 'use strict';
25 |
26 | /**
27 | * @author brian@bevey.org
28 | * @fileoverview Send mp3 playback commands to all Websocket connected
29 | * clients.
30 | */
31 | return {
32 | version : 20151007,
33 |
34 | inputs : ['text'],
35 |
36 | /**
37 | * Default to this device being active and workable.
38 | */
39 | init : function (controller) {
40 | var deviceState = require(__dirname + '/../../lib/deviceState');
41 |
42 | deviceState.updateState(controller.config.deviceId, 'clientMp3', { state : 'ok' });
43 | },
44 |
45 | /**
46 | * Accepts a sound name, then sends it to webSockets to be played aloud
47 | * client-side.
48 | *
49 | * Sounds are only available to clients that support both audio as well as
50 | * WebSockets. It's assumed that if you do not support WebSockets, it's
51 | * unlikely you support audio.
52 | */
53 | send : function (config) {
54 | var webSockets = require(__dirname + '/../../lib/webSockets'),
55 | text = config.text || '';
56 |
57 | if (text) {
58 | webSockets.send({ sound : text });
59 | }
60 | }
61 | };
62 | }());
63 |
--------------------------------------------------------------------------------
/devices/clientMp3/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/devices/clientScreenSaver/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | module.exports = (function () {
24 | 'use strict';
25 |
26 | /**
27 | * @author brian@bevey.org
28 | * @fileoverview Handles screensaver for wall-mounted OLED displays.
29 | */
30 | return {
31 | version : 20160626,
32 |
33 | /**
34 | * Default to this device being off.
35 | */
36 | init : function (controller) {
37 | var deviceState = require(__dirname + '/../../lib/deviceState');
38 |
39 | deviceState.updateState(controller.config.deviceId, 'clientScreenSaver', { state : 'err', value: { timeout : controller.config.timeout } });
40 | }
41 | };
42 | }());
43 |
--------------------------------------------------------------------------------
/devices/clientScreenSaver/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/devices/clientVibrate/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | module.exports = (function () {
24 | 'use strict';
25 |
26 | /**
27 | * @author brian@bevey.org
28 | * @fileoverview Send vibration command to all Websocket connected clients.
29 | */
30 | return {
31 | version : 20160314,
32 |
33 | inputs : ['text'],
34 |
35 | /**
36 | * Default to this device being active and workable.
37 | */
38 | init : function (controller) {
39 | var deviceState = require(__dirname + '/../../lib/deviceState');
40 |
41 | deviceState.updateState(controller.config.deviceId, 'clientVibrate', { state : 'ok' });
42 | },
43 |
44 | /**
45 | * Accepts a vibration duration number, then sends it to webSockets to be
46 | * executed client-side.
47 | *
48 | * Vibration is only available to clients that support both vibrate as well
49 | * as WebSockets. It's assumed that if you do not support WebSockets, it's
50 | * unlikely you support vibrate.
51 | */
52 | send : function (config) {
53 | var webSockets = require(__dirname + '/../../lib/webSockets'),
54 | vibrate = config.text || 0;
55 |
56 | if (vibrate) {
57 | webSockets.send({ vibrate : vibrate });
58 | }
59 | }
60 | };
61 | }());
62 |
--------------------------------------------------------------------------------
/devices/clientVibrate/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/devices/geiger/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20200321,
33 |
34 | /**
35 | * On poll, check the location data feed.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/geiger/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/github/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20151124,
33 |
34 | /**
35 | * On poll, check the GitHub feed.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/github/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/haveibeenpwned/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20160904,
33 |
34 | /**
35 | * On poll, check the haveibeenpwned feed.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/haveibeenpwned/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/location/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20151006,
33 |
34 | /**
35 | * On poll, check the location data feed.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/location/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{i18n_LOCATION}} {{DEVICE_ACTIVE}}
4 |
5 |
6 | {{LOCATION_DYNAMIC}}
7 |
8 |
9 |
--------------------------------------------------------------------------------
/devices/monoPrice3dPrinter/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.monoPrice3dPrinter = function (deviceId, markup, state, value) {
27 | value = value || {};
28 |
29 | markup = markup.split('{{EXTRUDER_TEMP}}').join(value.extruderTemp);
30 | markup = markup.split('{{EXTRUDER_TARGET}}').join(value.extruderTarget);
31 | markup = markup.split('{{BED_TEMP}}').join(value.bedTemp);
32 | markup = markup.split('{{BED_TARGET}}').join(value.bedTarget);
33 | markup = markup.split('{{PERCENT_COMPLETE}}').join(value.percent);
34 |
35 | return markup;
36 | };
37 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
38 |
--------------------------------------------------------------------------------
/devices/monoPrice3dPrinter/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/devices/neato/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20200412,
33 |
34 | /**
35 | * On poll, check the Neato API.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/neato/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/nest/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * Poll the Nest API.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/nest/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/devices/octoprint/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.octoprint = function (deviceId, markup, state, value, fragments) {
27 | var video = fragments.video;
28 |
29 | if (state === 'ok' && value && value.imagePath) {
30 | video = video.split('{{OCTOPRINT_DYNAMIC}}').join(value.imagePath);
31 | video = video.split('{{OCTOPRINT_STYLE}}').join(value.styles || '');
32 | } else {
33 | video = '';
34 | }
35 |
36 | value = value || {};
37 |
38 | markup = markup.split('{{EXTRUDER_TEMP}}').join(value.extruderTemp);
39 | markup = markup.split('{{EXTRUDER_TARGET}}').join(value.extruderTarget);
40 | markup = markup.split('{{BED_TEMP}}').join(value.bedTemp);
41 | markup = markup.split('{{BED_TARGET}}').join(value.bedTarget);
42 | markup = markup.split('{{PERCENT_COMPLETE}}').join(value.percent);
43 | markup = markup.split('{{OCTOPRINT_VIDEO}}').join(video);
44 |
45 | return markup;
46 | };
47 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
48 |
--------------------------------------------------------------------------------
/devices/octoprint/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 | {{OCTOPRINT_VIDEO}}
14 |
--------------------------------------------------------------------------------
/devices/piHole/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.piHole = function (deviceId, markup, state, value) {
27 | var now = new Date().getTime(),
28 | displayRelativeTime = function (milliseconds) {
29 | var util,
30 | time;
31 |
32 | if ((typeof SB === 'object') && (typeof SB.util === 'object')) {
33 | time = SB.util.displayRelativeTime(milliseconds);
34 | }
35 |
36 | else {
37 | util = require(__dirname + '/../../lib/sharedUtil').util;
38 | time = util.displayRelativeTime(milliseconds);
39 | }
40 |
41 | return time;
42 | };
43 |
44 | value = value || {};
45 |
46 | markup = markup.replace('{{PIHOLE_UPDATE}}', value.lastUpdate ? displayRelativeTime((now - value.lastUpdate) / 1000) : '');
47 | markup = markup.replace('{{PIHOLE_QUERIES_TODAY}}', value.queriesToday || '');
48 | markup = markup.replace('{{PIHOLE_QUERIES_BLOCKED_TODAY}}', value.queriesBlockedToday || '');
49 | markup = markup.replace('{{PIHOLE_PERCENT_BLOCKED_TODAY}}', value.percentBlockedToday || '');
50 | markup = markup.replace('{{PIHOLE_DOMAINS_BLOCKED}}', value.domainsBlocked || '');
51 |
52 | return markup;
53 | };
54 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
55 |
--------------------------------------------------------------------------------
/devices/piHole/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20190429,
33 |
34 | /**
35 | * On poll, check the Ph-Hole interface.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/piHole/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/raspberryRemote/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.raspberryRemote = function (deviceId, markup, state, value, fragments) {
27 | var templateSwitch = fragments.switch,
28 | i = 0,
29 | tempMarkup = '',
30 | subdevices,
31 | getDeviceMarkup = function (device) {
32 | var deviceTemplate = templateSwitch,
33 | deviceMarkup = '';
34 |
35 | deviceMarkup = deviceTemplate.split('{{SUB_DEVICE_ID}}').join(device.label.split(' ').join('+'));
36 | deviceMarkup = deviceMarkup.split('{{SUB_DEVICE_NAME}}').join(device.label);
37 |
38 | return deviceMarkup;
39 | };
40 |
41 | if ((value) && (typeof value === 'object')) {
42 | subdevices = value.devices;
43 |
44 | if (subdevices) {
45 | for (i in subdevices) {
46 | if (subdevices.hasOwnProperty(i)) {
47 | tempMarkup = tempMarkup + getDeviceMarkup(subdevices[i]);
48 | tempMarkup = tempMarkup.split('{{SUB_DEVICE_CLASS}}').join(subdevices[i].className || 'fa-lightbulb-o');
49 | }
50 | }
51 | }
52 | }
53 |
54 | return markup.replace('{{RASPBERRY_REMOTE_DYNAMIC}}', tempMarkup);
55 | };
56 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
57 |
--------------------------------------------------------------------------------
/devices/raspberryRemote/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/roku/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.roku = function (deviceId, markup, state, value, fragments) {
27 | var template = fragments.list,
28 | i = 0,
29 | tempMarkup = '';
30 |
31 | if (value) {
32 | for (i in value) {
33 | if (value.hasOwnProperty(i)) {
34 | tempMarkup = tempMarkup + template.split('{{APP_ID}}').join(value[i].id);
35 | tempMarkup = tempMarkup.split('{{APP_IMG}}').join(value[i].cache);
36 | tempMarkup = tempMarkup.split('{{APP_NAME}}').join(value[i].name);
37 | }
38 | }
39 | }
40 |
41 | return markup.replace('{{ROKU_DYNAMIC}}', tempMarkup);
42 | };
43 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
44 |
--------------------------------------------------------------------------------
/devices/rss/fragments/rss.tpl:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/devices/rss/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.rss = function (deviceId, markup, state, value, fragments) {
27 | var template = fragments.item,
28 | tempMarkup = '',
29 | i = 0,
30 | text = '';
31 |
32 | if ((state) && (value)) {
33 | for (i; i < value.length; i += 1) {
34 | text = value[i].description ? value[i].description : value[i].text;
35 | tempMarkup = tempMarkup + template.split('{{RSS_URL}}').join(value[i].url);
36 | tempMarkup = tempMarkup.split('{{RSS_TITLE}}').join(value[i].title);
37 | tempMarkup = tempMarkup.split('{{RSS_DESCRIPTION}}').join(text);
38 | }
39 | }
40 |
41 | markup = markup.replace('{{RSS_DYNAMIC}}', tempMarkup);
42 |
43 | return markup;
44 | };
45 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
46 |
--------------------------------------------------------------------------------
/devices/rss/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On poll, check the RSS feed.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/rss/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/smartthings/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On long interval, poll the SmartThings API just to sync state. This is
36 | * largely unnecessary, as state is sent through normal use via API
37 | * callbacks, but this will ensure things are current.
38 | */
39 | poll : function (deviceId) {
40 | var runCommand = require(__dirname + '/../../lib/runCommand');
41 |
42 | runCommand.runCommand(deviceId, 'list');
43 | }
44 | };
45 | }());
46 |
--------------------------------------------------------------------------------
/devices/smartthings/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/sports/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20160202,
33 |
34 | /**
35 | * On long interval, poll the ESPN API for the latest data.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/sports/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{i18n_SPORTS}} {{DEVICE_ACTIVE}}
4 |
5 | {{SPORTS_DYNAMIC}}
6 |
7 |
--------------------------------------------------------------------------------
/devices/tcl/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | module.exports = (function () {
24 | 'use strict';
25 |
26 | /**
27 | * @author brian@bevey.org
28 | * @fileoverview TCL TVs are controlled with Roku software. The controller is
29 | * the same, but we want a specific controller just for changes
30 | * to the template.
31 | */
32 | return require(__dirname + '/../roku/controller');
33 | }());
34 |
--------------------------------------------------------------------------------
/devices/tcl/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.tcl = function (deviceId, markup, state, value, fragments) {
27 | var template = fragments.list,
28 | i = 0,
29 | tempMarkup = '';
30 |
31 | if (value) {
32 | for (i in value) {
33 | if (value.hasOwnProperty(i)) {
34 | tempMarkup = tempMarkup + template.split('{{APP_ID}}').join(value[i].id);
35 | tempMarkup = tempMarkup.split('{{APP_IMG}}').join(value[i].cache);
36 | tempMarkup = tempMarkup.split('{{APP_NAME}}').join(value[i].name);
37 | }
38 | }
39 | }
40 |
41 | return markup.replace('{{TCL_DYNAMIC}}', tempMarkup);
42 | };
43 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
44 |
--------------------------------------------------------------------------------
/devices/traffic/fragments/traffic.tpl:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/devices/traffic/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.traffic = function (deviceId, markup, state, value, fragments) {
27 | var template = fragments.list,
28 | i = 0,
29 | tempMarkup = '';
30 |
31 | if (value) {
32 | for (i in value) {
33 | if (value.hasOwnProperty(i)) {
34 | tempMarkup = tempMarkup + template.split('{{CAM_IMG}}').join(value[i].image);
35 | tempMarkup = tempMarkup.split('{{CAM_NAME}}').join(value[i].title);
36 | }
37 | }
38 | }
39 |
40 | return markup.replace('{{TRAFFIC_DYNAMIC}}', tempMarkup);
41 | };
42 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
43 |
--------------------------------------------------------------------------------
/devices/traffic/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On poll, grab the latest traffic cam photos by incrementing the index.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/traffic/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/travis/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On poll, check the Travis build state.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/travis/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/twitter/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.twitter = function (deviceId, markup, state, value, fragments) {
27 | var template = fragments.tweet,
28 | tempMarkup = '',
29 | i = 0;
30 |
31 | if ((state) && (value)) {
32 | for (i; i < value.length; i += 1) {
33 | tempMarkup = tempMarkup + template.split('{{TWEET_TEXT}}').join(value[i].text);
34 | tempMarkup = tempMarkup.split('{{TWEET_URL}}').join(value[i].url);
35 | tempMarkup = tempMarkup.split('{{TWEET_AUTHOR}}').join(value[i].author);
36 | }
37 | }
38 |
39 | markup = markup.replace('{{TWITTER_DYNAMIC}}', tempMarkup);
40 |
41 | return markup;
42 | };
43 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
44 |
--------------------------------------------------------------------------------
/devices/twitter/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On poll, check Twitter state.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/twitter/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/weather/poller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Simple script to fire for each scheduled interval.
26 | */
27 |
28 | module.exports = (function () {
29 | 'use strict';
30 |
31 | return {
32 | version : 20150921,
33 |
34 | /**
35 | * On long interval, poll the Yahoo Weather API for the latest report.
36 | */
37 | poll : function (deviceId) {
38 | var runCommand = require(__dirname + '/../../lib/runCommand');
39 |
40 | runCommand.runCommand(deviceId, 'list');
41 | }
42 | };
43 | }());
44 |
--------------------------------------------------------------------------------
/devices/weather/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/devices/website/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | module.exports = (function () {
24 | 'use strict';
25 |
26 | /**
27 | * @author brian@bevey.org
28 | * @fileoverview Basic control of an iframe
29 | */
30 | return {
31 | version : 20160306,
32 |
33 | readOnly: true,
34 |
35 | inputs : ['list'],
36 |
37 | /**
38 | * Set state as soon as SwitchBoard starts up.
39 | */
40 | init : function (controller) {
41 | var runCommand = require(__dirname + '/../../lib/runCommand');
42 |
43 | runCommand.runCommand(controller.config.deviceId, 'list', controller.config.deviceId);
44 | },
45 |
46 | send : function (config) {
47 | var website = {};
48 |
49 | website.source = config.device.source || '';
50 | website.callback = config.callback || function () {};
51 |
52 | website.callback(null, website);
53 | }
54 | };
55 | }());
56 |
--------------------------------------------------------------------------------
/devices/website/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.website = function (deviceId, markup, state, value) {
27 | var source = '';
28 |
29 | if ((value) && (value.source)) {
30 | source = value.source;
31 | }
32 |
33 | return markup.replace('{{WEBSITE_DYNAMIC}}', source);
34 | };
35 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
36 |
--------------------------------------------------------------------------------
/devices/website/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/devices/xbmc/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | (function (exports){
24 | 'use strict';
25 |
26 | exports.xbmc = function (deviceId, markup, state, value, fragments) {
27 | var templateCurrent = fragments.current,
28 | current = '';
29 |
30 | if ((value) && (value.current)) {
31 | current = templateCurrent.split('{{DEVICE_CURRENT}}').join(value.current);
32 | }
33 |
34 | return markup.replace('{{XBMC_DYNAMIC}}', current);
35 | };
36 | })(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);
37 |
--------------------------------------------------------------------------------
/devices/xbmc/template.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
27 |
28 |
29 |
30 | {{DEVICE_INTERFACES}}
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/activeBuilding.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/activeBuilding.js
26 | */
27 |
28 | exports.activeBuildingTest = {
29 | activeBuilding : function (test) {
30 | 'use strict';
31 |
32 | var activeBuilding = require(__dirname + '/../../../../apps/gerty/activeBuilding'),
33 | deviceGood = activeBuilding.mood({ value : ['USPS', 'UPS', 'Dry Cleaning']}),
34 | deviceOk = activeBuilding.mood({ value : ['USPS']}),
35 | deviceBad = activeBuilding.mood({ value : []});
36 |
37 | test.deepEqual(deviceGood, { excited: 6 }, 'How exciting. You have several packages');
38 | test.deepEqual(deviceOk, { excited: 2 }, 'You have one package waiting');
39 | test.deepEqual(deviceBad, { excited: 0 }, 'Nothing special here');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/airQuality.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/airQuality.js
26 | */
27 |
28 | exports.airQualityTest = {
29 | airQuality : function (test) {
30 | 'use strict';
31 |
32 | var airQuality = require(__dirname + '/../../../../apps/gerty/airQuality'),
33 | allGood = airQuality.mood({ value : { report : [{ type : 'no2', value : 0.015 }, { type : 'pm25', value : 10 }, { type : 'co', value : 2 }] } }),
34 | allBad = airQuality.mood({ value : { report : [{ type : 'no2', value : 0.25 }, { type : 'pm25', value : 160 }, { type : 'co', value : 25 }] } }),
35 | mixed = airQuality.mood({ value : { report : [{ type : 'no2', value : 0.015 }, { type : 'pm25', value : 160 }, { type : 'co', value : 2 }] } });
36 |
37 | test.deepEqual(allGood, { scared : 0, comfortable : 3 }, 'All good');
38 | test.deepEqual(allBad, { scared : 5, comfortable : -5 }, 'All bad');
39 | test.deepEqual(mixed, { scared : 2, comfortable : 0 }, 'A mix of good and bad');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/blinds.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/blind.js
26 | */
27 |
28 | exports.blindTest = {
29 | blinds : function (test) {
30 | 'use strict';
31 |
32 | var blinds = require(__dirname + '/../../../../apps/gerty/blinds'),
33 | deviceGood = blinds.mood({ value : { devices : [{ state : 90 }, { state : 95 }]}}),
34 | deviceBad = blinds.mood({ value : { devices : [{ state : 90 }, { state : 69 }]}});
35 |
36 | test.deepEqual(deviceGood, { entertained: 2 }, 'That\'s fun - you can enjoy your view');
37 | test.deepEqual(deviceBad, { entertained: 0 }, 'Nothing special here');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/entertainment.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/entertainment.js
26 | */
27 |
28 | exports.entertainmentTest = {
29 | entertainment : function (test) {
30 | 'use strict';
31 |
32 | var entertainment = require(__dirname + '/../../../../apps/gerty/entertainment'),
33 | deviceOn = entertainment.mood({ state : 'ok' }),
34 | deviceOff = entertainment.mood({ state : 'err' });
35 |
36 | test.deepEqual(deviceOn, { entertained : 4 }, 'You should feel entertained');
37 | test.deepEqual(deviceOff, { entertained : 0 }, 'You should feel bored');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/stereo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/stereo.js
26 | */
27 |
28 | exports.stereoTest = {
29 | stereo : function (test) {
30 | 'use strict';
31 |
32 | var stereo = require(__dirname + '/../../../../apps/gerty/stereo'),
33 | deviceOn = stereo.mood({ state : 'ok' }),
34 | deviceOff = stereo.mood({ state : 'err' });
35 |
36 | test.deepEqual(deviceOn, { entertained : 1 }, 'You should feel entertained');
37 | test.deepEqual(deviceOff, { entertained : 0 }, 'You should feel bored');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/stocks.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/stocks.js
26 | */
27 |
28 | exports.stocksTest = {
29 | stocks : function (test) {
30 | 'use strict';
31 |
32 | var stocks = require(__dirname + '/../../../../apps/gerty/stocks'),
33 | deviceGood = stocks.mood({ value : { 'STOCK1' : { dayChangePercent : '5%' }, 'STOCK2' : { dayChangePercent : '7%' } } }),
34 | deviceOk = stocks.mood({ value : { 'STOCK1' : { dayChangePercent : '3%' }, 'STOCK2' : { dayChangePercent : '1%' } } }),
35 | deviceBad = stocks.mood({ value : { 'STOCK1' : { dayChangePercent : '-5%' }, 'STOCK2' : { dayChangePercent : '-7%' } } });
36 |
37 | test.deepEqual(deviceGood, { excited: 5, scared: 0 }, 'Your stocks are doing well');
38 | test.deepEqual(deviceOk, { excited: 2, scared: 0 }, 'Your stocks are doing ok');
39 | test.deepEqual(deviceBad, { excited: -5, scared: -5 }, 'Your stocks are doing pretty bad');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/travis.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/travis.js
26 | */
27 |
28 | exports.travisTest = {
29 | travis : function (test) {
30 | 'use strict';
31 |
32 | var travis = require(__dirname + '/../../../../apps/gerty/travis'),
33 | deviceOk = travis.mood({ values : { value : [{ status : 'ok' }, { status : 'err' }] } }),
34 | deviceFail = travis.mood({ values : { value : [{ status : 'err' }, { status : 'ok' }] } });
35 |
36 | test.deepEqual(deviceOk, { scared : 0 }, 'All is well in the world (or at least the latest build)');
37 | test.deepEqual(deviceFail, { scared : -3 }, 'It\'s broken!');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/tv.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/tv.js
26 | */
27 |
28 | exports.tvTest = {
29 | tv : function (test) {
30 | 'use strict';
31 |
32 | var tv = require(__dirname + '/../../../../apps/gerty/tv'),
33 | deviceOn = tv.mood({ state : 'ok' }),
34 | deviceOff = tv.mood({ state : 'err' });
35 |
36 | test.deepEqual(deviceOn, { entertained : 3 }, 'You should feel entertained');
37 | test.deepEqual(deviceOff, { entertained : 0 }, 'You should feel bored');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/vacuum.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/airQuality.js
26 | */
27 |
28 | exports.vacuumTest = {
29 | vacuum : function (test) {
30 | 'use strict';
31 |
32 | var vacuum = require(__dirname + '/../../../../apps/gerty/vacuum'),
33 | allGood = vacuum.mood({ value : { docked : true } }),
34 | allBad = vacuum.mood({ value : { docked : false } });
35 |
36 | test.deepEqual(allGood, { comfortable : 0 }, 'All good');
37 | test.deepEqual(allBad, { comfortable : -1 }, 'All bad');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/tests/unit/apps/gerty/weather.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for apps/gerty/weather.js
26 | */
27 |
28 | exports.weatherTest = {
29 | weather : function (test) {
30 | 'use strict';
31 |
32 | var weather = require(__dirname + '/../../../../apps/gerty/weather'),
33 | deviceHot = weather.mood({ value : { temp : 100, code : 40 } }),
34 | deviceNice = weather.mood({ value : { temp : 70, code : 26 } }),
35 | deviceSnow = weather.mood({ value : { temp : 30, code : 46 } });
36 |
37 | test.deepEqual(deviceHot, { excited: -1, comfortable: -8.666666666666668 }, 'This is just miserable weather');
38 | test.deepEqual(deviceNice, { excited: 0, comfortable: 5 }, 'Sunny. Comfy, but not too exciting');
39 | test.deepEqual(deviceSnow, { excited: 5, comfortable: -3.125 }, 'Snowing! Not comfy, but pretty exciting');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/devices/activeBuilding/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/activeBuilding/controller.js
26 | */
27 |
28 | exports.activeBuildingControllerTest = {
29 | postPrepare : function (test) {
30 | 'use strict';
31 |
32 | var activeBuildingController = require(__dirname + '/../../../../devices/activeBuilding/controller'),
33 | config = { host : 'TEST-host',
34 | port : '443',
35 | path : '/TEST/',
36 | method : 'GET',
37 | badData : 'FAILURE' },
38 | testData = activeBuildingController.postPrepare(config);
39 |
40 | test.deepEqual(testData, { host : 'TEST-host', port : '443', path : '/TEST/', method : 'GET' }, 'Additional params are filtered out.');
41 |
42 | test.done();
43 | }
44 | };
45 |
--------------------------------------------------------------------------------
/tests/unit/devices/debug/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/debug/parser.js
26 | */
27 |
28 | exports.debugParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var debugParser = require(__dirname + '/../../../../devices/debug/parser'),
33 | markup = '
',
34 | value = { clientCount: 1,
35 | cpuLoad: [5, 10, 15],
36 | freeMemory: 99,
37 | memoryUsed: 3853,
38 | percentMemory: 97,
39 | startup: 1449558084357,
40 | totalMemory: 3952,
41 | uptime: 3764084 },
42 | goodMarkup = debugParser.debug('dummy', markup, 'ok', value),
43 | noValue = debugParser.debug('dummy', markup, 'ok', null);
44 |
45 | test.strictEqual(goodMarkup.indexOf('{{'), -1, 'All values replaced');
46 | test.notStrictEqual(goodMarkup.indexOf('97%'), -1, 'Passed markup validated1');
47 | test.strictEqual(noValue.indexOf('{{'), -1, 'All values replaced');
48 | test.notStrictEqual(noValue.indexOf(' 0%'), -1, 'Passed markup validated');
49 |
50 | test.done();
51 | }
52 | };
53 |
--------------------------------------------------------------------------------
/tests/unit/devices/denon/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/denon/controller.js
26 | */
27 |
28 | exports.denonControllerTest = {
29 | hashTable : function (test) {
30 | 'use strict';
31 |
32 | var denonController = require(__dirname + '/../../../../devices/denon/controller'),
33 | power = denonController.hashTable.POWERON,
34 | volUp = denonController.hashTable.VOLUP,
35 | volDown = denonController.hashTable.VOLDOWN;
36 |
37 | test.strictEqual(power, 'ZMON', 'POWER_ON is mapped to ZMON');
38 | test.strictEqual(volUp, 'MVUP', 'VOLUP is mapped to MVUP');
39 | test.strictEqual(volDown, 'MVDOWN', 'VOLDOWN is mapped to MVDOWN');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/devices/denon/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/denon/parser.js
26 | */
27 |
28 | exports.denonParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var denonParser = require(__dirname + '/../../../../devices/denon/parser'),
33 | markup = '
'), -1, 'Passed markup validated');
41 |
42 | test.done();
43 | }
44 | };
45 |
--------------------------------------------------------------------------------
/tests/unit/devices/gerty/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/gerty/parser.js
26 | */
27 |
28 | exports.gertyParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var gertyParser = require(__dirname + '/../../../../devices/gerty/parser'),
33 | markup = '
Foo
{{GERTY_DYNAMIC}}{{GERTY_COMMENTS}}',
34 | state = { emoji : ':)',
35 | action : null,
36 | comments : [{ text : 'Testing 1' },
37 | { text : 'Testing 2'} ]},
38 | smile = gertyParser.gerty('dummy', markup, 'ok', state, {comment: '{{COMMENT}}'});
39 |
40 | test.strictEqual(smile.indexOf('{{'), -1, 'All values replaced');
41 | test.notStrictEqual(smile.indexOf(':)'), -1, 'Smile found');
42 | test.notStrictEqual(smile.indexOf('Testing 1'), -1, 'First comment');
43 | test.notStrictEqual(smile.indexOf('Testing 2'), -1, 'Second comment');
44 |
45 | test.done();
46 | }
47 | };
48 |
--------------------------------------------------------------------------------
/tests/unit/devices/mp3/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/mp3/controller.js
26 | */
27 |
28 | exports.mp3ControllerTest = {
29 | translateCommand : function (test) {
30 | 'use strict';
31 |
32 | var mp3Controller = require(__dirname + '/../../../../devices/mp3/controller'),
33 | BSD = mp3Controller.translateCommand('foo', 'freebsd'),
34 | Linux = mp3Controller.translateCommand('foo', 'linux'),
35 | Darwin = mp3Controller.translateCommand('foo', 'darwin'),
36 | Win32 = mp3Controller.translateCommand('foo', 'win32');
37 |
38 | test.deepEqual(BSD, { command : 'mpg123', params : ['foo'] }, 'MP3 on FreeBSD validation');
39 | test.deepEqual(Linux, { command : 'mpg123', params : ['foo'] }, 'MP3 on Linux validation');
40 | test.deepEqual(Darwin, { command : 'afplay', params : ['foo'] }, 'MP3 on Darwin validation');
41 | test.strictEqual(Win32, '', 'Win32 should return null as it\'s not supported');
42 |
43 | test.done();
44 | }
45 | };
46 |
--------------------------------------------------------------------------------
/tests/unit/devices/piHole/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/piHole/parser.js
26 | */
27 |
28 | exports.piHoleParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var piHoleParser = require(__dirname + '/../../../../devices/piHole/parser'),
33 | markup = '
',
34 | value = { lastUpdate : 1556421306000,
35 | queriesToday : '125,500',
36 | queriesBlockedToday : '99,999',
37 | percentBlockedToday : '15.5',
38 | domainsBlocked : '111,810' },
39 | goodMarkup = piHoleParser.piHole('dummy', markup, 'ok', value),
40 | noValue = piHoleParser.piHole('dummy', markup, 'ok', null);
41 |
42 | test.strictEqual(goodMarkup.indexOf('{{'), -1, 'All values replaced');
43 | test.notStrictEqual(goodMarkup.indexOf('125,500, 99,999, 15.5, 111,810'), -1, 'Passed markup validated');
44 | test.strictEqual(noValue.indexOf('{{'), -1, 'Confirmation');
45 |
46 | test.done();
47 | }
48 | };
49 |
--------------------------------------------------------------------------------
/tests/unit/devices/pioneer/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/pioneer/controller.js
26 | */
27 |
28 | exports.pioneerControllerTest = {
29 | hashTable : function (test) {
30 | 'use strict';
31 |
32 | var pioneerController = require(__dirname + '/../../../../devices/pioneer/controller'),
33 | power = pioneerController.hashTable.POWER,
34 | volUp = pioneerController.hashTable.VOLUP,
35 | tv = pioneerController.hashTable.TV;
36 |
37 | test.strictEqual(power, 'PZ', 'Power is mapped to PZ');
38 | test.strictEqual(volUp, 'VU', 'VOLUP is mapped to VU');
39 | test.strictEqual(tv, '05FN', 'TV is mapped to 05FN');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/devices/roku/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/roku/parser.js
26 | */
27 |
28 | exports.rokuParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var rokuParser = require(__dirname + '/../../../../devices/roku/parser'),
33 | markup = '
', 'Passed markup validated');
45 |
46 | test.done();
47 | }
48 | };
49 |
--------------------------------------------------------------------------------
/tests/unit/devices/tcl/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/tcl/parser.js
26 | */
27 |
28 | exports.tclParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var tclParser = require(__dirname + '/../../../../devices/tcl/parser'),
33 | markup = '
', 'Passed markup validated');
45 |
46 | test.done();
47 | }
48 | };
49 |
--------------------------------------------------------------------------------
/tests/unit/devices/traffic/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/traffic/controller.js
26 | */
27 |
28 | exports.trafficControllerTest = {
29 | fragments : function (test) {
30 | 'use strict';
31 |
32 | var trafficController = require(__dirname + '/../../../../devices/roku/controller'),
33 | fragments = trafficController.fragments();
34 |
35 | test.strictEqual(typeof fragments.list, 'string', 'Fragment verified');
36 |
37 | test.done();
38 | }
39 | };
40 |
--------------------------------------------------------------------------------
/tests/unit/devices/website/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/website/parser.js
26 | */
27 |
28 | exports.websiteParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var websiteParser = require(__dirname + '/../../../../devices/website/parser'),
33 | markup = '
', 'Passed markup validated');
42 |
43 | test.done();
44 | }
45 | };
46 |
--------------------------------------------------------------------------------
/tests/unit/devices/xbmc/controller.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/xbmc/controller.js
26 | */
27 |
28 | exports.xbmcControllerTest = {
29 | postData : function (test) {
30 | 'use strict';
31 |
32 | var xbmcController = require(__dirname + '/../../../../devices/xbmc/controller'),
33 | commandRequest = xbmcController.postData({ command : 'Left' }),
34 | textRequest = xbmcController.postData({ text : 'This is entered text' }),
35 | listRequest = xbmcController.postData({ list : true, player : 1 });
36 |
37 | test.strictEqual(commandRequest, '{"id":1,"jsonrpc":"2.0","method":"Input.Left"}', 'XBMC command validation');
38 | test.strictEqual(textRequest, '{"id":0,"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"This is entered text","done":false}}', 'XBMC text input validation');
39 | test.strictEqual(listRequest, '{"id":"VideoGetItem","jsonrpc":"2.0","method":"Player.GetItem","params":{"properties":["title","album","artist","showtitle"],"playerid":1}}', 'XBMC list command validation');
40 |
41 | test.done();
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/tests/unit/devices/xbmc/parser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for devices/xbmc/parser.js
26 | */
27 |
28 | exports.xbmcParserTest = {
29 | parser : function (test) {
30 | 'use strict';
31 |
32 | var xbmcParser = require(__dirname + '/../../../../devices/xbmc/parser'),
33 | markup = '
Foo
{{XBMC_DYNAMIC}}
',
34 | value = { current : 'Some Value' },
35 | goodMarkup = xbmcParser.xbmc('dummy', markup, 'ok', value, { current : '
', 'Passed markup validated 2');
43 |
44 | test.done();
45 | }
46 | };
47 |
--------------------------------------------------------------------------------
/tests/unit/lib/ai.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for ai.js
26 | */
27 |
28 | exports.ai = {
29 | getTimeCategory : function (test) {
30 | 'use strict';
31 |
32 | var ai = require(__dirname + '/../../../lib/ai'),
33 | dayOne = ai.getTimeCategory(1451073600000),
34 | dayTwo = ai.getTimeCategory(1451023600000);
35 |
36 | test.notEqual(dayOne, dayTwo, 'Ensure returned categories differ');
37 | test.strictEqual(dayOne.indexOf('Fri'), 0, 'Validate part of category name');
38 | test.done();
39 | },
40 |
41 | convertKeyType : function (test) {
42 | 'use strict';
43 |
44 | var ai = require(__dirname + '/../../../lib/ai'),
45 | string = ai.convertKeyType('not number'),
46 | int = ai.convertKeyType('123456'),
47 | float = ai.convertKeyType('123.456');
48 |
49 | test.strictEqual(string, 'not number', 'Strings are passed back unchanged');
50 | test.strictEqual(int, 123456, 'Integers are passed back type changed');
51 | test.strictEqual(float, 123, 'Floats are passed back as ints');
52 | test.done();
53 | }
54 | };
55 |
--------------------------------------------------------------------------------
/tests/unit/lib/auth.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for auth.js
26 | */
27 |
28 | exports.ai = {
29 | generateNonce : function (test) {
30 | 'use strict';
31 |
32 | var auth = require(__dirname + '/../../../lib/auth'),
33 | nonceDefault = auth.generateNonce(),
34 | nonce64 = auth.generateNonce(64),
35 | nonce5 = auth.generateNonce(5);
36 |
37 | test.strictEqual(nonceDefault.length, 32, 'Default nonce length is 32 bytes');
38 | test.strictEqual(nonce64.length, 64, 'Pass 64 and should get a 64 byte nonce');
39 | test.strictEqual(nonce5.length, 5, 'Pass 5 and should get a 64 byte nonce');
40 |
41 | test.done();
42 | },
43 |
44 | md5 : function (test) {
45 | 'use strict';
46 |
47 | var auth = require(__dirname + '/../../../lib/auth'),
48 | md5 = auth.md5('This is a test'),
49 | anotherMd5 = auth.md5('This is another test');
50 |
51 |
52 | test.strictEqual(md5, 'ce114e4501d2f4e2dcea3e17b546f339', 'MD5 summed');
53 | test.strictEqual(anotherMd5, 'a87edc4866a7e4257e5912ba9735d20e', 'Different string doesn\'t match');
54 |
55 | test.done();
56 | }
57 | };
58 |
--------------------------------------------------------------------------------
/tests/unit/lib/requestInit.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for requestInit.js
26 | */
27 |
28 | exports.requestInitTest = {
29 | requestIsStream : function (test) {
30 | 'use strict';
31 |
32 | var requestInit = require('../../../lib/requestInit'),
33 | requestBad = null,
34 | requestNone = { url : 'http://localhost/' },
35 | requestMixed = { url : 'http://localhost/?someDevice=sTrEaM' },
36 | requestNo = { url : 'http://localhost/?someDevice=VolUp' },
37 | requestYes = { url : 'http://localhost/?someDevice=stream' };
38 |
39 | test.strictEqual(requestInit.requestIsStream(requestBad), false, 'Bad commands should return false');
40 | test.strictEqual(requestInit.requestIsStream(requestNone), false, 'Unknown commands should return false');
41 | test.strictEqual(requestInit.requestIsStream(requestMixed), true, 'Stream commands are case insensitive');
42 | test.strictEqual(requestInit.requestIsStream(requestNo), false, 'Non-stream commands should return false');
43 | test.strictEqual(requestInit.requestIsStream(requestYes), true, 'Stream commands should return true');
44 | test.done();
45 | }
46 | };
47 |
--------------------------------------------------------------------------------
/tests/unit/lib/schedule.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014 brian@bevey.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | * IN THE SOFTWARE.
21 | */
22 |
23 | /**
24 | * @author brian@bevey.org
25 | * @fileoverview Unit test for schedule.js
26 | */
27 |
28 | exports.scheduleTest = {
29 | fire : function (test) {
30 | 'use strict';
31 |
32 | var schedule = require(__dirname + '/../../../lib/schedule'),
33 | controller = { weather : { config : { typeClass : 'weather' } },
34 | config : { config : { thisShouldnt : 'execute' } },
35 | foo : { config : { thisShouldnt : 'execute' } } };
36 |
37 | test.strictEqual(schedule.fire(controller), true, 'Schedule shouldnt choke on config or a poorly configured controller');
38 |
39 | test.done();
40 | }
41 | };
42 |
--------------------------------------------------------------------------------