2 Commits

3 changed files with 17 additions and 6 deletions

View File

@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.2] - 2020-03-08
### Fixed
- Fixed which property was being read to determine whether heat mode was enabled or not. Previously the state of the heater itself was being used to display on/off status, now the requested mode is used instead (the heater toggles on/off as part of normal operation even while heating is enabled).
## [1.1.1] - 2020-03-07
### Added
- Ability to specify which heat mode to use when enabling heating for a specific body. Previously mode 1 was always sent which means "solar" while most people probably want mode 3 which is "heat pump".
## [1.1.0] - 2020-03-01 ## [1.1.0] - 2020-03-01
### Added ### Added
- Ability to show buttons for controlling pool equipment (with a touch screen, for example). NOTE: running `npm install` again is necessary after upgrading to this version if the heat controls are used. - Ability to show buttons for controlling pool equipment (with a touch screen, for example). NOTE: running `npm install` again is necessary after upgrading to this version if the heat controls are used.

View File

@ -158,12 +158,13 @@ Module.register("MMM-ScreenLogic",{
class: this.config.contentClass class: this.config.contentClass
}); });
} else if (controlObj.type === 'heatmode') { } else if (controlObj.type === 'heatmode') {
if (controlObj.body < 0 || controlObj.body > poolData.status.heatStatus.length) { if (controlObj.body < 0 || controlObj.body > poolData.status.heatMode.length) {
Log.warn('Invalid body specified for heatmode'); Log.warn('Invalid body specified for heatmode');
continue; continue;
} }
var on = poolData.status.heatStatus[controlObj.body] !== 0; var on = poolData.status.heatMode[controlObj.body] !== 0;
var mode = typeof controlObj.heatMode === 'number' ? controlObj.heatMode : 3;
var cls = ''; var cls = '';
if (this.config.colored) { if (this.config.colored) {
@ -172,7 +173,7 @@ Module.register("MMM-ScreenLogic",{
contents.push({ contents.push({
data: '<button id="sl-heat-' + controlObj.body + '" class="control ' + cls + '" onclick="setHeatmode(this)" data-body="' + data: '<button id="sl-heat-' + controlObj.body + '" class="control ' + cls + '" onclick="setHeatmode(this)" data-body="' +
controlObj.body + '" data-state="' + (on ? '1' : '0') + '"><div class="content">' + controlObj.body + '" data-state="' + (on ? '1' : '0') + '" data-mode="' + mode.toString() + '"><div class="content">' +
controlObj.name + '</div></button>', controlObj.name + '</div></button>',
class: this.config.contentClass class: this.config.contentClass
}); });
@ -274,7 +275,8 @@ function setCircuit(e) {
function setHeatmode(e) { function setHeatmode(e) {
var bodyId = parseInt(e.dataset.body); var bodyId = parseInt(e.dataset.body);
var on = e.dataset.state !== '0'; var on = e.dataset.state !== '0';
moduleObj.sendSocketNotification('SCREENLOGIC_HEATSTATE', {body: bodyId, state: on ? 0 : 1}); var mode = e.dataset.mode;
moduleObj.sendSocketNotification('SCREENLOGIC_HEATSTATE', {body: bodyId, state: on ? 0 : parseInt(mode)});
e.classList.remove('control-on', 'control-off'); e.classList.remove('control-on', 'control-off');
} }

View File

@ -14,7 +14,7 @@ A <a href="https://github.com/MichMich/MagicMirror">MagicMirror²</a> module use
|`colored`|Boolean|Whether you'd like colored output or not.|`true`| |`colored`|Boolean|Whether you'd like colored output or not.|`true`|
|`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"`|
|`controls`|Array|List of controls to show buttons for. Must also set `showControls` to `true`.<br><br>Each entry in this list is an object with a `type` property and a `name` to display.<br><br>Valid `type`s:<br>`circuit` - toggle a circuit on or off. Must also have an `id` property defining the circuit ID to set (see [node-screenlogic](https://github.com/parnic/node-screenlogic) documentation for circuit IDs). `name` is optional; if not specified, the name of the equipment in the ScreenLogic system will be used.<br>`heatmode` - enable or disable the heater for the pool or spa. Must also have a `body` property that defines which body to toggle the heater for (`0` is the pool, `1` is the spa)<br>`heatpoint` - set the heat temperature for the pool or spa. Must also have a `body` property that defines which body to set the heat point for (`0` is the pool, `1` is the spa)|`[]`| |`controls`|Array|List of controls to show buttons for. Must also set `showControls` to `true`.<br><br>Each entry in this list is an object with a `type` string property and a `name` string to display.<br><br>Valid `type`s:<br>`"circuit"` - toggle a circuit on or off. Must also have an `id` number property defining the circuit ID to set (see [node-screenlogic](https://github.com/parnic/node-screenlogic) documentation for circuit IDs). `name` is an optional string; if not specified, the name of the equipment in the ScreenLogic system will be used.<br>`"heatmode"` - enable or disable the heater for the pool or spa. Must also have a `body` number property that defines which body to toggle the heater for (`0` is the pool, `1` is the spa). Can optionally have a `heatMode` number property that defines which heat mode to set; if not present, defaults to 3 ("heat pump").<br>`"heatpoint"` - set the heat temperature for the pool or spa. Must also have a `body` number property that defines which body to set the heat point for (`0` is the pool, `1` is the spa)|`[]`|
|`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`|
|`serverAddress`|String|The IPv4 address of a ScreenLogic unit to connect to. If not set, the system will search for a unit to connect to. If set, `serverPort` must also be set.| | |`serverAddress`|String|The IPv4 address of a ScreenLogic unit to connect to. If not set, the system will search for a unit to connect to. If set, `serverPort` must also be set.| |
|`serverPort`|Integer|The port of a ScreenLogic unit to connect to (usually 80). If not set, the system will search for a unit to connect to. If set, `serverAddress` must also be set.| | |`serverPort`|Integer|The port of a ScreenLogic unit to connect to (usually 80). If not set, the system will search for a unit to connect to. If set, `serverAddress` must also be set.| |
@ -43,7 +43,8 @@ Here is an example of an entry in config.js
{type: 'circuit', id: 500}, {type: 'circuit', id: 500},
{type: 'circuit', id: 505, name: 'Pool'}, {type: 'circuit', id: 505, name: 'Pool'},
{type: 'heatmode', body: 0, name: 'Pool heater'}, {type: 'heatmode', body: 0, name: 'Pool heater'},
{type: 'heatpoint', body: 0, name: 'Pool'} {type: 'heatpoint', body: 0, name: 'Pool'},
{type: 'heatmode', body: 1, heatMode: 2, name: 'Spa heater'},
] ]
} }
}, },