@avantics/node-red-home-automation 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -83
- package/contract-examples/room-lighting.mjs +3 -5
- package/dist/lib/avr-controller.d.ts +23 -0
- package/dist/lib/avr-controller.js +139 -39
- package/dist/lib/circadian-refresh.d.ts +7 -0
- package/dist/lib/circadian-refresh.js +11 -0
- package/dist/lib/circadian-schedule.d.ts +11 -0
- package/dist/lib/circadian-schedule.js +63 -0
- package/dist/lib/circadian.d.ts +6 -0
- package/dist/lib/circadian.js +15 -0
- package/dist/lib/display-mode-controller.d.ts +16 -0
- package/dist/lib/display-mode-controller.js +60 -1
- package/dist/lib/light-styling.d.ts +11 -0
- package/dist/lib/light-styling.js +15 -0
- package/dist/lib/occupancy-fusion.js +3 -2
- package/dist/lib/room-controller.d.ts +9 -14
- package/dist/lib/room-controller.js +15 -58
- package/dist/lib/source-capability-controller.d.ts +2 -0
- package/dist/lib/source-capability-controller.js +20 -3
- package/dist/nodes/avr-controller.html +10 -1
- package/dist/nodes/avr-controller.js +11 -11
- package/dist/nodes/display-mode-controller.html +2 -2
- package/dist/nodes/display-mode-controller.js +3 -2
- package/dist/nodes/room-controller.html +19 -15
- package/dist/nodes/room-controller.js +20 -21
- package/dist/nodes/theatre-activity-controller.html +1 -1
- package/dist/nodes/theatre-activity-controller.js +7 -0
- package/examples/Home theatre activity.json +299 -36
- package/examples/Room lighting.json +8 -10
- package/package.json +3 -7
- package/THIRD-PARTY-NOTICES.md +0 -218
|
@@ -7,18 +7,16 @@
|
|
|
7
7
|
area: {value: "room", required: true},
|
|
8
8
|
displayName: {value: "Room", required: true},
|
|
9
9
|
targets: {value: "[]", required: true},
|
|
10
|
-
latitude: {value: "", required: true, validate: RED.validators.number()},
|
|
11
|
-
longitude: {value: "", required: true, validate: RED.validators.number()},
|
|
12
|
-
minBrightnessPct: {value: 1, required: true, validate: RED.validators.number()},
|
|
13
10
|
maxBrightnessPct: {value: 100, required: true, validate: RED.validators.number()},
|
|
14
|
-
|
|
15
|
-
maxColorTempKelvin: {value: 5500, required: true, validate: RED.validators.number()},
|
|
11
|
+
maxColorTempKelvin: {value: 6500, required: true, validate: RED.validators.number()},
|
|
16
12
|
sleepBrightnessPct: {value: 1, required: true, validate: RED.validators.number()},
|
|
17
|
-
sleepColorTempKelvin: {value:
|
|
13
|
+
sleepColorTempKelvin: {value: 2200, required: true, validate: RED.validators.number()},
|
|
18
14
|
initialTransitionSeconds: {value: 1, required: true, validate: RED.validators.number()},
|
|
19
|
-
refreshTransitionSeconds: {value:
|
|
20
|
-
refreshSeconds: {value:
|
|
21
|
-
initialSleep: {value: false}
|
|
15
|
+
refreshTransitionSeconds: {value: 60, required: true, validate: RED.validators.number()},
|
|
16
|
+
refreshSeconds: {value: 60, required: true, validate: RED.validators.number()},
|
|
17
|
+
initialSleep: {value: false},
|
|
18
|
+
wakeTime: {value: "07:00", required: true, validate: function (v) { return /^([01]\d|2[0-3]):[0-5]\d$/.test(v); }},
|
|
19
|
+
bedTime: {value: "23:00", required: true, validate: function (v) { return /^([01]\d|2[0-3]):[0-5]\d$/.test(v); }}
|
|
22
20
|
},
|
|
23
21
|
inputs: 1,
|
|
24
22
|
outputs: 1,
|
|
@@ -32,22 +30,28 @@
|
|
|
32
30
|
<div class="form-row"><label for="node-input-area">Area</label><input type="text" id="node-input-area"></div>
|
|
33
31
|
<div class="form-row"><label for="node-input-displayName">Display name</label><input type="text" id="node-input-displayName"></div>
|
|
34
32
|
<div class="form-row"><label for="node-input-targets">Targets JSON</label><input type="text" id="node-input-targets"></div>
|
|
35
|
-
<div class="form-row"><label for="node-input-
|
|
36
|
-
<div class="form-row"><label for="node-input-
|
|
37
|
-
<div class="form-row"><label for="node-input-minBrightnessPct">Minimum brightness %</label><input type="number" id="node-input-minBrightnessPct"></div>
|
|
38
|
-
<div class="form-row"><label for="node-input-maxBrightnessPct">Maximum brightness %</label><input type="number" id="node-input-maxBrightnessPct"></div>
|
|
39
|
-
<div class="form-row"><label for="node-input-minColorTempKelvin">Minimum kelvin</label><input type="number" id="node-input-minColorTempKelvin"></div>
|
|
40
|
-
<div class="form-row"><label for="node-input-maxColorTempKelvin">Maximum kelvin</label><input type="number" id="node-input-maxColorTempKelvin"></div>
|
|
33
|
+
<div class="form-row"><label for="node-input-maxBrightnessPct">Daytime brightness %</label><input type="number" id="node-input-maxBrightnessPct"></div>
|
|
34
|
+
<div class="form-row"><label for="node-input-maxColorTempKelvin">Daytime kelvin</label><input type="number" id="node-input-maxColorTempKelvin"></div>
|
|
41
35
|
<div class="form-row"><label for="node-input-sleepBrightnessPct">Sleep brightness %</label><input type="number" id="node-input-sleepBrightnessPct"></div>
|
|
42
36
|
<div class="form-row"><label for="node-input-sleepColorTempKelvin">Sleep kelvin</label><input type="number" id="node-input-sleepColorTempKelvin"></div>
|
|
43
37
|
<div class="form-row"><label for="node-input-initialTransitionSeconds">Initial transition seconds</label><input type="number" id="node-input-initialTransitionSeconds"></div>
|
|
44
38
|
<div class="form-row"><label for="node-input-refreshTransitionSeconds">Refresh transition seconds</label><input type="number" id="node-input-refreshTransitionSeconds"></div>
|
|
45
39
|
<div class="form-row"><label for="node-input-refreshSeconds">Refresh interval seconds</label><input type="number" id="node-input-refreshSeconds"></div>
|
|
40
|
+
<div class="form-row"><label for="node-input-wakeTime">Wake time</label><input type="text" id="node-input-wakeTime" placeholder="07:00"></div>
|
|
41
|
+
<div class="form-row"><label for="node-input-bedTime">Bed time</label><input type="text" id="node-input-bedTime" placeholder="23:00"></div>
|
|
46
42
|
<div class="form-row"><label for="node-input-initialSleep">Initial sleep mode</label><input type="checkbox" id="node-input-initialSleep" style="display:inline-block; width:auto;"></div>
|
|
47
43
|
</script>
|
|
48
44
|
|
|
49
45
|
<script type="text/html" data-help-name="home-room-lighting-controller">
|
|
50
46
|
<p>Owns room MQTT commands, adaptive colour and brightness, manual overrides, discovery and bounded tracing.</p>
|
|
47
|
+
<h3>Circadian schedule</h3>
|
|
48
|
+
<p>Circadian levels follow <b>Wake time</b> and <b>Bed time</b> (24-hour <code>HH:MM</code>, default 07:00 and
|
|
49
|
+
23:00): they rise to the daytime level over the hour after waking, stay at the daytime brightness and colour
|
|
50
|
+
through the day, wind down to the sleep settings over the three hours before bed, and stay at the sleep
|
|
51
|
+
settings until you wake. A bed time after midnight, or a wake time later than the bed time, works. Sleep mode
|
|
52
|
+
still overrides the schedule.</p>
|
|
53
|
+
<p>Times are the Node-RED host's local time. Docker containers default to UTC: set the container's
|
|
54
|
+
<code>TZ</code> if your host should follow a local timezone.</p>
|
|
51
55
|
<h3>Control state</h3>
|
|
52
56
|
<p>Each target has one control state:</p>
|
|
53
57
|
<dl class="message-properties">
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const bounded_trace_1 = require("../lib/bounded-trace");
|
|
3
3
|
const room_controller_1 = require("../lib/room-controller");
|
|
4
|
+
const circadian_1 = require("../lib/circadian");
|
|
5
|
+
const circadian_schedule_1 = require("../lib/circadian-schedule");
|
|
4
6
|
function number(value, fallback) {
|
|
5
7
|
const parsed = Number(value);
|
|
6
8
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
7
9
|
}
|
|
8
|
-
function requiredNumber(value, name) {
|
|
9
|
-
if (value === "" || value === null || value === undefined) {
|
|
10
|
-
throw new Error(`${name} is required`);
|
|
11
|
-
}
|
|
12
|
-
const parsed = Number(value);
|
|
13
|
-
if (!Number.isFinite(parsed))
|
|
14
|
-
throw new Error(`${name} must be a number`);
|
|
15
|
-
return parsed;
|
|
16
|
-
}
|
|
17
10
|
function parseTargets(value) {
|
|
18
11
|
const targets = JSON.parse(value || "[]");
|
|
19
12
|
if (!Array.isArray(targets) || targets.some((target) => {
|
|
@@ -40,26 +33,32 @@ const registerRoomController = (RED) => {
|
|
|
40
33
|
let refreshTimer;
|
|
41
34
|
let controllerConfig;
|
|
42
35
|
try {
|
|
36
|
+
// Saved latitude, longitude and minimum settings from earlier versions
|
|
37
|
+
// are ignored.
|
|
38
|
+
const levels = {
|
|
39
|
+
maxBrightnessPct: number(config.maxBrightnessPct, 100),
|
|
40
|
+
maxColorTempKelvin: number(config.maxColorTempKelvin, 6500),
|
|
41
|
+
sleepBrightnessPct: number(config.sleepBrightnessPct, 1),
|
|
42
|
+
sleepColorTempKelvin: number(config.sleepColorTempKelvin, 2200)
|
|
43
|
+
};
|
|
44
|
+
const schedule = (0, circadian_schedule_1.resolveSchedule)(config.wakeTime, config.bedTime);
|
|
43
45
|
controllerConfig = {
|
|
44
46
|
area: config.area || "room",
|
|
45
47
|
displayName: config.displayName || config.area || "Room",
|
|
46
48
|
targets: parseTargets(config.targets),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
minBrightnessPct: number(config.minBrightnessPct, 1),
|
|
50
|
-
maxBrightnessPct: number(config.maxBrightnessPct, 100),
|
|
51
|
-
minColorTempKelvin: number(config.minColorTempKelvin, 2000),
|
|
52
|
-
maxColorTempKelvin: number(config.maxColorTempKelvin, 5500),
|
|
53
|
-
sleepBrightnessPct: number(config.sleepBrightnessPct, 1),
|
|
54
|
-
sleepColorTempKelvin: number(config.sleepColorTempKelvin, 1000),
|
|
49
|
+
...levels,
|
|
50
|
+
...schedule,
|
|
55
51
|
initialTransitionSeconds: number(config.initialTransitionSeconds, 1),
|
|
56
|
-
refreshTransitionSeconds: number(config.refreshTransitionSeconds,
|
|
57
|
-
initialSleep: config.initialSleep === true || config.initialSleep === "true"
|
|
52
|
+
refreshTransitionSeconds: number(config.refreshTransitionSeconds, 60),
|
|
53
|
+
initialSleep: config.initialSleep === true || config.initialSleep === "true",
|
|
54
|
+
// The adapter picks the circadian lighting; the controller only asks
|
|
55
|
+
// it how a light should look.
|
|
56
|
+
lighting: (0, circadian_1.scheduledLighting)(schedule, levels)
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
59
|
catch (error) {
|
|
61
60
|
node.status({ fill: "red", shape: "ring", text: "invalid configuration" });
|
|
62
|
-
node.error(error);
|
|
61
|
+
node.error("invalid configuration: " + (error instanceof Error ? error.message : String(error)));
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
64
|
function updateStatus(status) {
|
|
@@ -104,7 +103,7 @@ const registerRoomController = (RED) => {
|
|
|
104
103
|
done(error instanceof Error ? error : new Error(String(error)));
|
|
105
104
|
}
|
|
106
105
|
});
|
|
107
|
-
const refreshSeconds = Math.max(10, number(config.refreshSeconds,
|
|
106
|
+
const refreshSeconds = Math.max(10, number(config.refreshSeconds, 60));
|
|
108
107
|
refreshTimer = setInterval(() => {
|
|
109
108
|
try {
|
|
110
109
|
process({ lighting: { kind: "refresh" } }, node.send.bind(node));
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
|
|
28
28
|
<script type="text/html" data-help-name="home-theatre-activity-controller">
|
|
29
29
|
<p>Owns latest-request-wins whole-theatre activity state and aggregates generation-scoped target evidence.</p>
|
|
30
|
-
<p>Input <code>msg.theatre</code> accepts activity intent, target-state, startup, refresh, recovery and tick events. Output 1 emits semantic <code>msg.theatreCommand</code> messages for target owners. Output 2 emits activity events and a complete state snapshot. Device transports remain separate.</p>
|
|
30
|
+
<p>Input <code>msg.theatre</code> accepts activity intent, target-state, startup, refresh, recovery and tick events. Messages without <code>msg.theatre</code>, such as a target controller's own events on the same wire, are ignored. Output 1 emits semantic <code>msg.theatreCommand</code> messages for target owners. Output 2 emits activity events and a complete state snapshot. Device transports remain separate.</p>
|
|
31
31
|
<p>Startup without persisted intent probes physical state. One fresh profile match is adopted without commands; zero or multiple matches invoke the configured coordinated Off activity. Manual overrides are held without corrective commands and adopted only when the physical state uniquely matches a profile.</p>
|
|
32
32
|
</script>
|
|
@@ -62,6 +62,13 @@ const registerTheatreActivityController = (RED) => {
|
|
|
62
62
|
return result;
|
|
63
63
|
}
|
|
64
64
|
node.on("input", (msg, send, done) => {
|
|
65
|
+
// Target controllers' output 2 also carries their own events (such as
|
|
66
|
+
// msg.avr and msg.display) beside target state; only msg.theatre is
|
|
67
|
+
// for this controller.
|
|
68
|
+
if (!msg.theatre || typeof msg.theatre !== "object") {
|
|
69
|
+
done();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
65
72
|
try {
|
|
66
73
|
process({
|
|
67
74
|
theatre: msg.theatre && typeof msg.theatre === "object"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "example-home-theatre-activity-home-theatre-activity-example",
|
|
4
4
|
"type": "comment",
|
|
5
5
|
"name": "Home theatre activity example",
|
|
6
|
-
"info": "The state contract turns a request on home/room/theatre/request into an activity intent. The activity controller plans each target
|
|
6
|
+
"info": "The state contract turns a request on home/room/theatre/request into an activity intent. The activity controller plans each target and sends msg.theatreCommand; the switch routes each command by its target, and a change node moves it onto that controller's input. Every controller reports msg.theatre target state on output 2, wired straight back to the activity controller, which publishes a complete snapshot through the contract.\n\nSet the display controller's device hosts and TV pre-shared key before deploying; until then it shows \"invalid configuration\" and the activity waits for it. Wire the controllers' output 1 to your device transports and activity lighting to your room lighting controller.",
|
|
7
7
|
"x": 190,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -108,12 +108,12 @@
|
|
|
108
108
|
"area": "room",
|
|
109
109
|
"freshnessMs": 30000,
|
|
110
110
|
"recoveryOffActivity": "off",
|
|
111
|
-
"activityProfiles": "{\"off\":{\"display\":{\"mode\":\"off\"},\"avr\":{\"power\":\"
|
|
111
|
+
"activityProfiles": "{\"off\":{\"display\":{\"mode\":\"off\"},\"avr\":{\"power\":\"standby\"},\"source\":{\"action\":\"deactivate\",\"readiness\":\"optional\"},\"lighting\":{\"profile\":\"off\"},\"backlighting\":{\"power\":\"off\"}},\"tv\":{\"display\":{\"mode\":\"tv\"},\"avr\":{\"power\":\"on\",\"source\":\"shield\"},\"source\":{\"action\":\"activate\",\"sourceId\":\"streamer\",\"readiness\":\"required\"},\"lighting\":{\"profile\":\"tv\"},\"backlighting\":{\"power\":\"on\"}}}",
|
|
112
112
|
"x": 680,
|
|
113
113
|
"y": 140,
|
|
114
114
|
"wires": [
|
|
115
115
|
[
|
|
116
|
-
"example-home-theatre-activity-target
|
|
116
|
+
"example-home-theatre-activity-route-by-target"
|
|
117
117
|
],
|
|
118
118
|
[
|
|
119
119
|
"example-home-theatre-activity-theatre-state-contract"
|
|
@@ -121,9 +121,28 @@
|
|
|
121
121
|
]
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
|
-
"id": "example-home-theatre-activity-
|
|
124
|
+
"id": "example-home-theatre-activity-activity-lighting-controller",
|
|
125
|
+
"type": "home-activity-lighting-controller",
|
|
126
|
+
"name": "",
|
|
127
|
+
"area": "room",
|
|
128
|
+
"profiles": "{\"off\":{\"targets\":[],\"values\":{}},\"tv\":{\"targets\":[\"main\"],\"values\":{\"brightness\":64,\"color_temp\":400}}}",
|
|
129
|
+
"confirmationTimeoutMs": 15000,
|
|
130
|
+
"maxAttempts": 2,
|
|
131
|
+
"x": 1380,
|
|
132
|
+
"y": 440,
|
|
133
|
+
"wires": [
|
|
134
|
+
[
|
|
135
|
+
"example-home-theatre-activity-room-lighting-intents"
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"example-home-theatre-activity-theatre-activity-controller"
|
|
139
|
+
]
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "example-home-theatre-activity-room-lighting-intents",
|
|
125
144
|
"type": "debug",
|
|
126
|
-
"name": "
|
|
145
|
+
"name": "room lighting intents",
|
|
127
146
|
"active": true,
|
|
128
147
|
"tosidebar": true,
|
|
129
148
|
"console": false,
|
|
@@ -132,57 +151,240 @@
|
|
|
132
151
|
"targetType": "full",
|
|
133
152
|
"statusVal": "",
|
|
134
153
|
"statusType": "auto",
|
|
154
|
+
"x": 1630,
|
|
155
|
+
"y": 440,
|
|
156
|
+
"wires": []
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "example-home-theatre-activity-route-by-target",
|
|
160
|
+
"type": "switch",
|
|
161
|
+
"name": "route by target",
|
|
162
|
+
"property": "theatreCommand.target",
|
|
163
|
+
"propertyType": "msg",
|
|
164
|
+
"rules": [
|
|
165
|
+
{
|
|
166
|
+
"t": "eq",
|
|
167
|
+
"v": "display",
|
|
168
|
+
"vt": "str"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"t": "eq",
|
|
172
|
+
"v": "avr",
|
|
173
|
+
"vt": "str"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"t": "eq",
|
|
177
|
+
"v": "source",
|
|
178
|
+
"vt": "str"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"t": "eq",
|
|
182
|
+
"v": "lighting",
|
|
183
|
+
"vt": "str"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"t": "eq",
|
|
187
|
+
"v": "backlighting",
|
|
188
|
+
"vt": "str"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"checkall": "true",
|
|
192
|
+
"repair": false,
|
|
193
|
+
"outputs": 5,
|
|
135
194
|
"x": 930,
|
|
136
|
-
"y":
|
|
195
|
+
"y": 300,
|
|
196
|
+
"wires": [
|
|
197
|
+
[
|
|
198
|
+
"example-home-theatre-activity-to-display"
|
|
199
|
+
],
|
|
200
|
+
[
|
|
201
|
+
"example-home-theatre-activity-to-avr"
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"example-home-theatre-activity-to-source"
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
"example-home-theatre-activity-to-lighting"
|
|
208
|
+
],
|
|
209
|
+
[
|
|
210
|
+
"example-home-theatre-activity-to-backlighting"
|
|
211
|
+
]
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"id": "example-home-theatre-activity-to-display",
|
|
216
|
+
"type": "change",
|
|
217
|
+
"name": "to display",
|
|
218
|
+
"rules": [
|
|
219
|
+
{
|
|
220
|
+
"t": "move",
|
|
221
|
+
"p": "theatreCommand",
|
|
222
|
+
"pt": "msg",
|
|
223
|
+
"to": "display",
|
|
224
|
+
"tot": "msg"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"x": 1140,
|
|
228
|
+
"y": 200,
|
|
229
|
+
"wires": [
|
|
230
|
+
[
|
|
231
|
+
"example-home-theatre-activity-display-controller"
|
|
232
|
+
]
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "example-home-theatre-activity-display-controller",
|
|
237
|
+
"type": "home-display-mode-controller",
|
|
238
|
+
"name": "",
|
|
239
|
+
"area": "room",
|
|
240
|
+
"tvHost": "",
|
|
241
|
+
"screenHost": "",
|
|
242
|
+
"projectorMeterHost": "",
|
|
243
|
+
"screenOpenPosition": 82,
|
|
244
|
+
"screenTolerance": 2,
|
|
245
|
+
"pollMs": 2000,
|
|
246
|
+
"queryTimeoutMs": 5000,
|
|
247
|
+
"tvTimeoutMs": 30000,
|
|
248
|
+
"screenTimeoutMs": 65000,
|
|
249
|
+
"projectorWarmupMs": 60000,
|
|
250
|
+
"projectorMinimumWarmupMs": 15000,
|
|
251
|
+
"projectorShutdownConfirmMs": 5000,
|
|
252
|
+
"projectorCooldownMs": 120000,
|
|
253
|
+
"maxAttempts": 2,
|
|
254
|
+
"projectorOnWatts": 20,
|
|
255
|
+
"projectorOffWatts": 10,
|
|
256
|
+
"projectorPowerFallback": false,
|
|
257
|
+
"transportTimeoutMs": 5000,
|
|
258
|
+
"x": 1380,
|
|
259
|
+
"y": 200,
|
|
260
|
+
"wires": [
|
|
261
|
+
[
|
|
262
|
+
"example-home-theatre-activity-display-commands"
|
|
263
|
+
],
|
|
264
|
+
[
|
|
265
|
+
"example-home-theatre-activity-theatre-activity-controller"
|
|
266
|
+
]
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "example-home-theatre-activity-display-commands",
|
|
271
|
+
"type": "debug",
|
|
272
|
+
"name": "display commands",
|
|
273
|
+
"active": true,
|
|
274
|
+
"tosidebar": true,
|
|
275
|
+
"console": false,
|
|
276
|
+
"tostatus": false,
|
|
277
|
+
"complete": "true",
|
|
278
|
+
"targetType": "full",
|
|
279
|
+
"statusVal": "",
|
|
280
|
+
"statusType": "auto",
|
|
281
|
+
"x": 1630,
|
|
282
|
+
"y": 200,
|
|
137
283
|
"wires": []
|
|
138
284
|
},
|
|
139
285
|
{
|
|
140
|
-
"id": "example-home-theatre-activity-
|
|
141
|
-
"type": "
|
|
142
|
-
"name": "
|
|
143
|
-
"
|
|
286
|
+
"id": "example-home-theatre-activity-to-avr",
|
|
287
|
+
"type": "change",
|
|
288
|
+
"name": "to avr",
|
|
289
|
+
"rules": [
|
|
144
290
|
{
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
291
|
+
"t": "move",
|
|
292
|
+
"p": "theatreCommand",
|
|
293
|
+
"pt": "msg",
|
|
294
|
+
"to": "avr",
|
|
295
|
+
"tot": "msg"
|
|
148
296
|
}
|
|
149
297
|
],
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"once": false,
|
|
153
|
-
"onceDelay": 0.1,
|
|
154
|
-
"topic": "",
|
|
155
|
-
"x": 170,
|
|
156
|
-
"y": 240,
|
|
298
|
+
"x": 1140,
|
|
299
|
+
"y": 280,
|
|
157
300
|
"wires": [
|
|
158
301
|
[
|
|
159
|
-
"example-home-theatre-activity-
|
|
302
|
+
"example-home-theatre-activity-avr-controller"
|
|
160
303
|
]
|
|
161
304
|
]
|
|
162
305
|
},
|
|
163
306
|
{
|
|
164
|
-
"id": "example-home-theatre-activity-
|
|
165
|
-
"type": "home-
|
|
307
|
+
"id": "example-home-theatre-activity-avr-controller",
|
|
308
|
+
"type": "home-avr-controller",
|
|
166
309
|
"name": "",
|
|
167
310
|
"area": "room",
|
|
168
|
-
"
|
|
311
|
+
"sources": "{\"shield\":\"SAT/CBL\",\"playstation\":\"GAME\"}",
|
|
312
|
+
"retryMs": 2000,
|
|
313
|
+
"maxAttempts": 3,
|
|
314
|
+
"minVolume": 0,
|
|
315
|
+
"maxVolume": 60,
|
|
316
|
+
"x": 1380,
|
|
317
|
+
"y": 280,
|
|
318
|
+
"wires": [
|
|
319
|
+
[
|
|
320
|
+
"example-home-theatre-activity-avr-commands"
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
"example-home-theatre-activity-theatre-activity-controller"
|
|
324
|
+
]
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"id": "example-home-theatre-activity-avr-commands",
|
|
329
|
+
"type": "debug",
|
|
330
|
+
"name": "avr commands",
|
|
331
|
+
"active": true,
|
|
332
|
+
"tosidebar": true,
|
|
333
|
+
"console": false,
|
|
334
|
+
"tostatus": false,
|
|
335
|
+
"complete": "true",
|
|
336
|
+
"targetType": "full",
|
|
337
|
+
"statusVal": "",
|
|
338
|
+
"statusType": "auto",
|
|
339
|
+
"x": 1630,
|
|
340
|
+
"y": 280,
|
|
341
|
+
"wires": []
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"id": "example-home-theatre-activity-to-source",
|
|
345
|
+
"type": "change",
|
|
346
|
+
"name": "to sourceCapability",
|
|
347
|
+
"rules": [
|
|
348
|
+
{
|
|
349
|
+
"t": "move",
|
|
350
|
+
"p": "theatreCommand",
|
|
351
|
+
"pt": "msg",
|
|
352
|
+
"to": "sourceCapability",
|
|
353
|
+
"tot": "msg"
|
|
354
|
+
}
|
|
355
|
+
],
|
|
356
|
+
"x": 1140,
|
|
357
|
+
"y": 360,
|
|
358
|
+
"wires": [
|
|
359
|
+
[
|
|
360
|
+
"example-home-theatre-activity-source-controller"
|
|
361
|
+
]
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"id": "example-home-theatre-activity-source-controller",
|
|
366
|
+
"type": "home-source-capability-controller",
|
|
367
|
+
"name": "",
|
|
368
|
+
"area": "room",
|
|
369
|
+
"sources": "{\"streamer\":{\"activation\":\"command\",\"deactivation\":\"command\",\"confirmation\":\"active\"}}",
|
|
370
|
+
"pollMs": 2000,
|
|
169
371
|
"confirmationTimeoutMs": 15000,
|
|
170
372
|
"maxAttempts": 2,
|
|
171
|
-
"x":
|
|
172
|
-
"y":
|
|
373
|
+
"x": 1380,
|
|
374
|
+
"y": 360,
|
|
173
375
|
"wires": [
|
|
174
376
|
[
|
|
175
|
-
"example-home-theatre-activity-
|
|
377
|
+
"example-home-theatre-activity-source-commands"
|
|
176
378
|
],
|
|
177
379
|
[
|
|
178
|
-
"example-home-theatre-activity-
|
|
380
|
+
"example-home-theatre-activity-theatre-activity-controller"
|
|
179
381
|
]
|
|
180
382
|
]
|
|
181
383
|
},
|
|
182
384
|
{
|
|
183
|
-
"id": "example-home-theatre-activity-
|
|
385
|
+
"id": "example-home-theatre-activity-source-commands",
|
|
184
386
|
"type": "debug",
|
|
185
|
-
"name": "
|
|
387
|
+
"name": "source commands",
|
|
186
388
|
"active": true,
|
|
187
389
|
"tosidebar": true,
|
|
188
390
|
"console": false,
|
|
@@ -191,14 +393,75 @@
|
|
|
191
393
|
"targetType": "full",
|
|
192
394
|
"statusVal": "",
|
|
193
395
|
"statusType": "auto",
|
|
194
|
-
"x":
|
|
195
|
-
"y":
|
|
396
|
+
"x": 1630,
|
|
397
|
+
"y": 360,
|
|
196
398
|
"wires": []
|
|
197
399
|
},
|
|
198
400
|
{
|
|
199
|
-
"id": "example-home-theatre-activity-lighting
|
|
401
|
+
"id": "example-home-theatre-activity-to-lighting",
|
|
402
|
+
"type": "change",
|
|
403
|
+
"name": "to activityLighting",
|
|
404
|
+
"rules": [
|
|
405
|
+
{
|
|
406
|
+
"t": "move",
|
|
407
|
+
"p": "theatreCommand",
|
|
408
|
+
"pt": "msg",
|
|
409
|
+
"to": "activityLighting",
|
|
410
|
+
"tot": "msg"
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
"x": 1140,
|
|
414
|
+
"y": 440,
|
|
415
|
+
"wires": [
|
|
416
|
+
[
|
|
417
|
+
"example-home-theatre-activity-activity-lighting-controller"
|
|
418
|
+
]
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"id": "example-home-theatre-activity-to-backlighting",
|
|
423
|
+
"type": "change",
|
|
424
|
+
"name": "to backlighting",
|
|
425
|
+
"rules": [
|
|
426
|
+
{
|
|
427
|
+
"t": "move",
|
|
428
|
+
"p": "theatreCommand",
|
|
429
|
+
"pt": "msg",
|
|
430
|
+
"to": "backlighting",
|
|
431
|
+
"tot": "msg"
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
"x": 1140,
|
|
435
|
+
"y": 520,
|
|
436
|
+
"wires": [
|
|
437
|
+
[
|
|
438
|
+
"example-home-theatre-activity-backlighting-controller"
|
|
439
|
+
]
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"id": "example-home-theatre-activity-backlighting-controller",
|
|
444
|
+
"type": "home-backlighting-controller",
|
|
445
|
+
"name": "",
|
|
446
|
+
"area": "room",
|
|
447
|
+
"pollMs": 2000,
|
|
448
|
+
"confirmationTimeoutMs": 15000,
|
|
449
|
+
"maxAttempts": 2,
|
|
450
|
+
"x": 1380,
|
|
451
|
+
"y": 520,
|
|
452
|
+
"wires": [
|
|
453
|
+
[
|
|
454
|
+
"example-home-theatre-activity-backlighting-commands"
|
|
455
|
+
],
|
|
456
|
+
[
|
|
457
|
+
"example-home-theatre-activity-theatre-activity-controller"
|
|
458
|
+
]
|
|
459
|
+
]
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"id": "example-home-theatre-activity-backlighting-commands",
|
|
200
463
|
"type": "debug",
|
|
201
|
-
"name": "
|
|
464
|
+
"name": "backlighting commands",
|
|
202
465
|
"active": true,
|
|
203
466
|
"tosidebar": true,
|
|
204
467
|
"console": false,
|
|
@@ -207,8 +470,8 @@
|
|
|
207
470
|
"targetType": "full",
|
|
208
471
|
"statusVal": "",
|
|
209
472
|
"statusType": "auto",
|
|
210
|
-
"x":
|
|
211
|
-
"y":
|
|
473
|
+
"x": 1630,
|
|
474
|
+
"y": 520,
|
|
212
475
|
"wires": []
|
|
213
476
|
}
|
|
214
477
|
]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "example-room-lighting-room-lighting-example",
|
|
4
4
|
"type": "comment",
|
|
5
5
|
"name": "Room lighting example",
|
|
6
|
-
"info": "Motion and illuminance feed occupancy fusion and the motion policy; a wall switch feeds the switch policy. Both send lighting intents to the room controller, which owns the light's commands.\n\nReplace the inject nodes with your sensors and wire the room controller's output to your MQTT broker. Set the room's
|
|
6
|
+
"info": "Motion and illuminance feed occupancy fusion and the motion policy; a wall switch feeds the switch policy. Both send lighting intents to the room controller, which owns the light's commands.\n\nReplace the inject nodes with your sensors and wire the room controller's output to your MQTT broker. Set the room's wake and bed times (Node-RED host time) before deploying.",
|
|
7
7
|
"x": 170,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -175,17 +175,13 @@
|
|
|
175
175
|
"area": "room",
|
|
176
176
|
"displayName": "Room",
|
|
177
177
|
"targets": "[{\"id\":\"main\",\"stateTopic\":\"room/light/main\",\"commandTopic\":\"room/light/main/set\"}]",
|
|
178
|
-
"latitude": 0,
|
|
179
|
-
"longitude": 0,
|
|
180
|
-
"minBrightnessPct": 1,
|
|
181
178
|
"maxBrightnessPct": 100,
|
|
182
|
-
"
|
|
183
|
-
"maxColorTempKelvin": 5500,
|
|
179
|
+
"maxColorTempKelvin": 6500,
|
|
184
180
|
"sleepBrightnessPct": 1,
|
|
185
|
-
"sleepColorTempKelvin":
|
|
181
|
+
"sleepColorTempKelvin": 2200,
|
|
186
182
|
"initialTransitionSeconds": 1,
|
|
187
|
-
"refreshTransitionSeconds":
|
|
188
|
-
"refreshSeconds":
|
|
183
|
+
"refreshTransitionSeconds": 60,
|
|
184
|
+
"refreshSeconds": 60,
|
|
189
185
|
"initialSleep": false,
|
|
190
186
|
"x": 880,
|
|
191
187
|
"y": 180,
|
|
@@ -193,7 +189,9 @@
|
|
|
193
189
|
[
|
|
194
190
|
"example-room-lighting-room-commands"
|
|
195
191
|
]
|
|
196
|
-
]
|
|
192
|
+
],
|
|
193
|
+
"wakeTime": "07:00",
|
|
194
|
+
"bedTime": "23:00"
|
|
197
195
|
},
|
|
198
196
|
{
|
|
199
197
|
"id": "example-room-lighting-room-commands",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avantics/node-red-home-automation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Deterministic home automation components for Node-RED",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"dist/nodes",
|
|
26
26
|
"examples",
|
|
27
27
|
"contract-examples",
|
|
28
|
-
"THIRD-PARTY-NOTICES.md",
|
|
29
28
|
"!dist/**/*.js.map"
|
|
30
29
|
],
|
|
31
30
|
"scripts": {
|
|
@@ -35,10 +34,8 @@
|
|
|
35
34
|
"examples": "npm run build && node contract-examples/run.mjs",
|
|
36
35
|
"scan:public": "node scripts/check-public.mjs",
|
|
37
36
|
"hooks:install": "git config core.hooksPath .githooks",
|
|
38
|
-
"prepack": "npm run build"
|
|
39
|
-
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"suncalc": "2.1.4"
|
|
37
|
+
"prepack": "npm run build",
|
|
38
|
+
"diagrams": "node scripts/render-diagrams.mjs"
|
|
42
39
|
},
|
|
43
40
|
"engines": {
|
|
44
41
|
"node": ">=22.9"
|
|
@@ -62,7 +59,6 @@
|
|
|
62
59
|
"devDependencies": {
|
|
63
60
|
"@types/node": "24.19.2",
|
|
64
61
|
"@types/node-red": "1.3.5",
|
|
65
|
-
"@types/suncalc": "1.9.2",
|
|
66
62
|
"typescript": "7.0.2"
|
|
67
63
|
}
|
|
68
64
|
}
|