Added configurable update interval
Bumped to 1.0.2
This commit is contained in:
@ -13,7 +13,8 @@ Module.register("MMM-ScreenLogic",{
|
|||||||
coldTemp: 84,
|
coldTemp: 84,
|
||||||
hotTemp: 90,
|
hotTemp: 90,
|
||||||
columns: 3,
|
columns: 3,
|
||||||
contentClass: "light"
|
contentClass: "light",
|
||||||
|
updateInterval: 30 * 60 * 1000
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
|
@ -24,6 +24,7 @@ A <a href="https://github.com/MichMich/MagicMirror">MagicMirror²</a> module use
|
|||||||
|`hotTemp`|Integer|Show the temperature colored red if it's at or above this level for pool/spa (requires option `colored`). This is in whatever scale your system is set to (Fahrenheit/Celsius).|`90`|
|
|`hotTemp`|Integer|Show the temperature colored red if it's at or above this level for pool/spa (requires option `colored`). This is in whatever scale your system is set to (Fahrenheit/Celsius).|`90`|
|
||||||
|`columns`|Integer|How many columns to use to display the data before starting a new row.|`3`|
|
|`columns`|Integer|How many columns to use to display the data before starting a new row.|`3`|
|
||||||
|`contentClass`|String|The CSS class used to display content values (beneath the header).|`"light"`|
|
|`contentClass`|String|The CSS class used to display content values (beneath the header).|`"light"`|
|
||||||
|
|`updateInterval`|Integer|How frequently, in milliseconds, to update pool data.|`30 * 60 * 1000` (every 30 minutes)|
|
||||||
|
|
||||||
Here is an example of an entry in config.js
|
Here is an example of an entry in config.js
|
||||||
```
|
```
|
||||||
@ -48,7 +49,7 @@ Pull requests are very welcome! If you'd like to see any additional functionalit
|
|||||||
|
|
||||||
This module only works with ScreenLogic controllers on the local network via either a UDP broadcast on 255.255.255.255 or a direct connection if you've specified an address and port in the configuration.
|
This module only works with ScreenLogic controllers on the local network via either a UDP broadcast on 255.255.255.255 or a direct connection if you've specified an address and port in the configuration.
|
||||||
|
|
||||||
The data is updated every 30 minutes.
|
The data is updated every 30 minutes by default (configurable with `updateInterval`).
|
||||||
|
|
||||||
## Libraries
|
## Libraries
|
||||||
This uses a Node.JS library I created for interfacing with ScreenLogic controllers over the network: <a href="https://github.com/parnic/node-screenlogic">node-screenlogic</a>, so feel free to check that out for more information.
|
This uses a Node.JS library I created for interfacing with ScreenLogic controllers over the network: <a href="https://github.com/parnic/node-screenlogic">node-screenlogic</a>, so feel free to check that out for more information.
|
||||||
@ -57,3 +58,6 @@ This uses a Node.JS library I created for interfacing with ScreenLogic controlle
|
|||||||
|
|
||||||
### v1.0.1
|
### v1.0.1
|
||||||
* Added `showFreezeMode` to show a banner acrosss the top if the pool is currently in freeze-protection mode.
|
* Added `showFreezeMode` to show a banner acrosss the top if the pool is currently in freeze-protection mode.
|
||||||
|
|
||||||
|
### v1.0.2
|
||||||
|
* Added `updateInterval` to control how often the pool data is updated (default 30 minutes).
|
||||||
|
@ -2,10 +2,7 @@ var NodeHelper = require('node_helper');
|
|||||||
|
|
||||||
module.exports = NodeHelper.create({
|
module.exports = NodeHelper.create({
|
||||||
start: function() {
|
start: function() {
|
||||||
var self = this;
|
this.setTimer(30 * 60 * 1000);
|
||||||
setInterval(function() {
|
|
||||||
self.doUpdate()
|
|
||||||
}, 30 * 60 * 1000);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
doUpdate: function() {
|
doUpdate: function() {
|
||||||
@ -15,9 +12,27 @@ module.exports = NodeHelper.create({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTimer: function(updateInterval) {
|
||||||
|
var update = true;
|
||||||
|
update = typeof this.updateInterval === 'undefined' || this.updateInterval != updateInterval;
|
||||||
|
this.updateInterval = updateInterval;
|
||||||
|
|
||||||
|
if (update) {
|
||||||
|
if (typeof this.timer !== 'undefined') {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
self.timer = setInterval(function() {
|
||||||
|
self.doUpdate()
|
||||||
|
}, self.updateInterval);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
socketNotificationReceived: function(notification, payload) {
|
socketNotificationReceived: function(notification, payload) {
|
||||||
if (notification === 'SCREENLOGIC_CONFIG') {
|
if (notification === 'SCREENLOGIC_CONFIG') {
|
||||||
this.config = payload;
|
this.config = payload;
|
||||||
|
this.setTimer(this.config.updateInterval);
|
||||||
}
|
}
|
||||||
if (notification === 'SCREENLOGIC_UPDATE') {
|
if (notification === 'SCREENLOGIC_UPDATE') {
|
||||||
this.doUpdate();
|
this.doUpdate();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "magic-mirror-module-screenlogic",
|
"name": "magic-mirror-module-screenlogic",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "Show data from Pentair ScreenLogic systems",
|
"description": "Show data from Pentair ScreenLogic systems",
|
||||||
"main": "MMM-ScreenLogic.js",
|
"main": "MMM-ScreenLogic.js",
|
||||||
"author": "Chris Pickett",
|
"author": "Chris Pickett",
|
||||||
|
Reference in New Issue
Block a user