Skip to content

Commit

Permalink
Merge pull request #10 from biddster/develop
Browse files Browse the repository at this point in the history
Release 0.7.0
  • Loading branch information
biddster committed Apr 30, 2016
2 parents 4847447 + 0e47541 commit c8175ae
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Change directory to your node red installation:
$ npm install node-red-contrib-schedex

### Configuration

#### Suspending scheduling

The 'Suspend scheduling' checkbox allows you to disable time scheduling. If scheduling is suspended,
Schedex will only generate output events upon receipt of input 'on' and 'off' events (see below).

This setting is provided for the situation where you temporarily don't want time based activation
and don't want to rewire your Node-RED flow.

#### Times

Expand Down
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
color: '#f37a33',
defaults: {
name: {value: ''},
suspended: {value: false},
lat: {value: ''},
lon: {value: ''},
ontime: {value: '07:28'},
Expand Down Expand Up @@ -67,6 +68,12 @@
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label style="margin-left: 100px; width: 70%">
<input type="checkbox" id="node-input-suspended" placeholder="" style="width: 20px; margin: 0">
Suspend scheduling
</label>
</div>
<hr>
<div class="form-row">
<label for="node-input-lat"><i class="fa fa-globe"></i> Latitude</label>
Expand Down Expand Up @@ -134,6 +141,13 @@ <h1>SCHEDEX</h1>

Inspired by Pete Scargill's <a href="http://tech.scargill.net/big-timer/">BigTimer</a>
<h2>Suspending scheduling</h2>
The 'Suspend scheduling' checkbox allows you to disable time scheduling. If scheduling is suspended, Schedex will only generate output events
upon receipt of input 'on' and 'off' events (see below).
This setting is provided for the situation where you temporarily don't want time based activation and don't want to
rewire your Node-RED flow.
<h2>Times</h2>
</p>
Expand Down
22 changes: 14 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module.exports = function (RED) {
node.status({
fill: manual ? 'blue' : 'green',
shape: event.shape,
text: event.name + (manual ? ' manual' : ' auto') + ' until ' + event.inverse.moment.format(fmt)
text: event.name + (manual ? ' manual' : ' auto') + (config.suspended ? ' - scheduling suspended' : (' until ' + event.inverse.moment.format(fmt)))
});
}

Expand Down Expand Up @@ -118,12 +118,18 @@ module.exports = function (RED) {
}
}

schedule(events.on, true);
schedule(events.off, true);
var firstEvent = events.on.moment.isBefore(events.off.moment) ? events.on : events.off;
var message = firstEvent.name + ' ' + firstEvent.moment.format(fmt) + ', ' +
firstEvent.inverse.name + ' ' + firstEvent.inverse.moment.format(fmt);
node.log(message);
node.status({fill: 'yellow', shape: 'dot', text: message});
node.log('Scheduling suspended is: ' + config.suspended);

if (config.suspended) {
node.status({fill: 'grey', shape: 'dot', text: 'Scheduling suspended - manual mode only'});
} else {
schedule(events.on, true);
schedule(events.off, true);
var firstEvent = events.on.moment.isBefore(events.off.moment) ? events.on : events.off;
var message = firstEvent.name + ' ' + firstEvent.moment.format(fmt) + ', ' +
firstEvent.inverse.name + ' ' + firstEvent.inverse.moment.format(fmt);
node.log(message);
node.status({fill: 'yellow', shape: 'dot', text: message});
}
});
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "node-red-contrib-schedex",
"version": "0.6.1",
"version": "0.7.0",
"description": "",
"main": "index.js",
"keywords": [ "node-red", "router", "switch", "time" ],
"keywords": ["node-red", "schedule", "scheduler", "timer", "sun events"],
"scripts": {
"test": "mocha -R spec ./tests/test.js"
},
Expand Down

0 comments on commit c8175ae

Please sign in to comment.