Skip to content

Commit

Permalink
Merge pull request #51 from rdmtc/dev
Browse files Browse the repository at this point in the history
0.4.8 - Maintenance
  • Loading branch information
Hypnos3 authored Aug 22, 2019
2 parents ad4122e + f203d66 commit 3b18e9c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 40 deletions.
59 changes: 30 additions & 29 deletions blind_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ Used to control a blind with many possibilities. This can be time-dependent and

### Table of contents

* [Blind Controller](#Blind-Controller)
* [blind-control](#blind-control)
* [Table of contents](#Table-of-contents)
* [The node](#The-node)
* [Node settings](#Node-settings)
* [general settings](#general-settings)
* [blind settings](#blind-settings)
* [rule settings](#rule-settings)
* [overwrite settings](#overwrite-settings)
* [sun settings](#sun-settings)
* [maximize sunlight (Winter)](#maximize-sunlight-Winter)
* [restrict sunlight (Summer)](#restrict-sunlight-Summer)
* [sun position settings](#sun-position-settings)
* [Node Input](#Node-Input)
* [Node Output](#Node-Output)
* [Node Status](#Node-Status)
* [rules](#rules)
* [rules execution in detail](#rules-execution-in-detail)
* [rules example](#rules-example)
* [Samples](#Samples)
* [Example 1](#Example-1)
* [Example 2](#Example-2)
* [Example 3 - testing rules and overrides](#Example-3---testing-rules-and-overrides)
* [Example 4 - usage of message properties](#Example-4---usage-of-message-properties)
* [Additional FAQ](#Additional-FAQ)
* [Why is there no multi blind controller? (FAQ)](#Why-is-there-no-multi-blind-controller-FAQ)
* [How to define a Temperature Overwrite? (FAQ)](#How-to-define-a-Temperature-Overwrite-FAQ)
* [How do I achieve that when opening a window the blind opens? (FAQ)](#How-do-I-achieve-that-when-opening-a-window-the-blind-opens-FAQ)
* [Other](#Other)
- [Blind Controller](#Blind-Controller)
- [blind-control](#blind-control)
- [Table of contents](#Table-of-contents)
- [The node](#The-node)
- [Node settings](#Node-settings)
- [general settings](#general-settings)
- [blind settings](#blind-settings)
- [rule settings](#rule-settings)
- [overwrite settings](#overwrite-settings)
- [sun settings](#sun-settings)
- [maximize sunlight (Winter)](#maximize-sunlight-Winter)
- [restrict sunlight (Summer)](#restrict-sunlight-Summer)
- [sun position settings](#sun-position-settings)
- [Node Input](#Node-Input)
- [Node Output](#Node-Output)
- [Node Status](#Node-Status)
- [rules](#rules)
- [rules execution in detail](#rules-execution-in-detail)
- [rules example](#rules-example)
- [Samples](#Samples)
- [Example 1](#Example-1)
- [Example 2](#Example-2)
- [Example 3 - testing rules and overrides](#Example-3---testing-rules-and-overrides)
- [Example 4 - usage of message properties](#Example-4---usage-of-message-properties)
- [Additional FAQ](#Additional-FAQ)
- [Why is there no multi blind controller? (FAQ)](#Why-is-there-no-multi-blind-controller-FAQ)
- [How to define a Temperature Overwrite? (FAQ)](#How-to-define-a-Temperature-Overwrite-FAQ)
- [How do I achieve that when opening a window the blind opens? (FAQ)](#How-do-I-achieve-that-when-opening-a-window-the-blind-opens-FAQ)
- [Other](#Other)

### The node

Expand Down Expand Up @@ -203,6 +203,7 @@ Useful to know:
* an incoming message with `msg.mode`, `msg.payload.mode` or where the `msg.topic` contains `setMode` and the value of `msg.payload` is a valid number, will allow to set the mode of the sun control.
* a value of `0` will deactivate sun control, `1` will set to maximize sunlight (Winter) and `2` will set to restrict sunlight (Summer).
* The maximum adjustable mode is influenced by the settings of the node. The mode can not be set to restrict sunlight (`2`) if in the settings is setup only maximize sunlight (`1`).
* A message where the topic contains `triggerOnly` or or with an property `msg.trigger` which is true can not act as override.

### Node Output

Expand Down
5 changes: 3 additions & 2 deletions nodes/blind-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,10 @@ module.exports = function (RED) {
// if active, the prio must be 0 or given with same or higher as current overwrite otherwise this will not work
return true;
}
const onlyTrigger = hlp.getMsgBoolValue(msg, ['trigger', 'noOverwrite'], ['triggerOnly', 'noOverwrite']);
let newPos = hlp.getMsgNumberValue(msg, ['blindPosition', 'position', 'level', 'blindLevel'], ['manual', 'levelOverwrite']);
const expire = hlp.getMsgNumberValue(msg, 'expire', 'expire');
if (node.blindData.overwrite.active && isNaN(newPos)) {
if (!onlyTrigger && node.blindData.overwrite.active && isNaN(newPos)) {
node.debug(`overwrite active, check of prio=${prio} or expire=${expire}, newPos=${newPos}`);
if (Number.isFinite(expire)) {
// set to new expiring time
Expand All @@ -415,7 +416,7 @@ module.exports = function (RED) {
setOverwriteReason(node);
node.debug(`overwrite exit true node.blindData.overwrite.active=${node.blindData.overwrite.active}, newPos=${newPos}, expire=${expire}`);
return true;
} else if (!isNaN(newPos)) {
} else if (!onlyTrigger && !isNaN(newPos)) {
node.debug(`needOverwrite prio=${prio} expire=${expire} newPos=${newPos}`);
if (newPos === -1) {
node.tempData.level = NaN;
Expand Down
19 changes: 11 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-sun-position",
"version": "0.4.7",
"version": "0.4.8",
"description": "NodeRED nodes to get sun and moon position",
"keywords": [
"node-red",
Expand Down

0 comments on commit 3b18e9c

Please sign in to comment.