node-red-contrib-alice 2.2.5 → 2.3.3
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/.claude/settings.local.json +11 -0
- package/CLAUDE.md +54 -0
- package/nodes/alice-color.js +208 -231
- package/nodes/alice-device.js +252 -286
- package/nodes/alice-event.js +110 -114
- package/nodes/alice-get.js +2 -3
- package/nodes/alice-mode.js +136 -145
- package/nodes/alice-onoff.js +126 -130
- package/nodes/alice-range.js +144 -150
- package/nodes/alice-sensor.js +105 -106
- package/nodes/alice-togle.js +118 -125
- package/nodes/alice-video.js +88 -132
- package/nodes/alice.js +11 -18
- package/nodes/types.js +3 -0
- package/package.json +2 -7
- package/src/alice-color.html +255 -0
- package/src/alice-color.ts +227 -0
- package/src/alice-device.html +94 -0
- package/src/alice-device.ts +301 -0
- package/src/alice-event.html +148 -0
- package/src/alice-event.ts +112 -0
- package/src/alice-get.ts +12 -15
- package/src/alice-mode.html +296 -0
- package/src/alice-mode.ts +139 -0
- package/src/alice-onoff.html +93 -0
- package/src/alice-onoff.ts +132 -0
- package/src/alice-range.html +293 -0
- package/src/alice-range.ts +144 -0
- package/src/alice-sensor.html +307 -0
- package/src/alice-sensor.ts +108 -0
- package/src/alice-togle.html +96 -0
- package/src/alice-togle.ts +122 -0
- package/src/alice-video.html +90 -0
- package/src/alice-video.ts +99 -0
- package/src/alice.ts +98 -248
- package/src/types.ts +157 -0
- package/tsconfig.json +13 -106
- package/.eslintrc.json +0 -20
package/nodes/alice-video.js
CHANGED
|
@@ -1,132 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function AliceVideo(config){
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
// this.on('input', (msg, send, done)=>{
|
|
92
|
-
// if (typeof msg.payload != 'boolean'){
|
|
93
|
-
// this.error("Wrong type! msg.payload must be boolean.");
|
|
94
|
-
// if (done) {done();}
|
|
95
|
-
// return;
|
|
96
|
-
// };
|
|
97
|
-
// if (msg.payload === curentState.state.value){
|
|
98
|
-
// this.debug("Value not changed. Cancel update");
|
|
99
|
-
// if (done) {done();}
|
|
100
|
-
// return;
|
|
101
|
-
// };
|
|
102
|
-
// curentState.state.value = msg.payload;
|
|
103
|
-
// device.updateCapabState(id,curentState)
|
|
104
|
-
// .then(ref=>{
|
|
105
|
-
// this.status({fill:"green",shape:"dot",text:msg.payload.toString()});
|
|
106
|
-
// if (done) {done();}
|
|
107
|
-
// })
|
|
108
|
-
// .catch(err=>{
|
|
109
|
-
// this.error("Error on update capability state: " + err.message);
|
|
110
|
-
// this.status({fill:"red",shape:"dot",text:"Error"});
|
|
111
|
-
// if (done) {done();}
|
|
112
|
-
// })
|
|
113
|
-
// });
|
|
114
|
-
|
|
115
|
-
this.on('close', (removed, done)=>{
|
|
116
|
-
device.setMaxListeners(device.getMaxListeners() - 1);
|
|
117
|
-
if (removed) {
|
|
118
|
-
device.delCapability(id)
|
|
119
|
-
.then(res=>{
|
|
120
|
-
done()
|
|
121
|
-
})
|
|
122
|
-
.catch(err=>{
|
|
123
|
-
this.error("Error on delete capability: " + err.message);
|
|
124
|
-
done();
|
|
125
|
-
})
|
|
126
|
-
};
|
|
127
|
-
done();
|
|
128
|
-
return;
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
RED.nodes.registerType("Video",AliceVideo);
|
|
132
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = (RED) => {
|
|
3
|
+
function AliceVideo(config) {
|
|
4
|
+
RED.nodes.createNode(this, config);
|
|
5
|
+
const device = RED.nodes.getNode(config.device);
|
|
6
|
+
device.setMaxListeners(device.getMaxListeners() + 1);
|
|
7
|
+
const id = this.id;
|
|
8
|
+
const ctype = 'devices.capabilities.video_stream';
|
|
9
|
+
const instance = 'get_stream';
|
|
10
|
+
const stream_url = config.stream_url;
|
|
11
|
+
const protocol = config.protocol;
|
|
12
|
+
const curentState = {
|
|
13
|
+
type: ctype,
|
|
14
|
+
state: {
|
|
15
|
+
instance: instance,
|
|
16
|
+
value: {
|
|
17
|
+
stream_url: stream_url,
|
|
18
|
+
protocol: protocol
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.status({ fill: "red", shape: "dot", text: "offline" });
|
|
23
|
+
const init = () => {
|
|
24
|
+
this.debug("Starting capability initilization ...");
|
|
25
|
+
const capab = {
|
|
26
|
+
type: ctype,
|
|
27
|
+
retrievable: false,
|
|
28
|
+
reportable: false,
|
|
29
|
+
parameters: {
|
|
30
|
+
instance: instance,
|
|
31
|
+
protocols: [protocol]
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
device.setCapability(id, capab)
|
|
35
|
+
.then(() => {
|
|
36
|
+
this.debug("Capability initilization - success!");
|
|
37
|
+
this.status({ fill: "green", shape: "dot", text: "online" });
|
|
38
|
+
})
|
|
39
|
+
.catch(err => {
|
|
40
|
+
this.error("Error on create capability: " + err.message);
|
|
41
|
+
this.status({ fill: "red", shape: "dot", text: "Error" });
|
|
42
|
+
});
|
|
43
|
+
device.updateCapabState(id, curentState)
|
|
44
|
+
.then(() => {
|
|
45
|
+
this.status({ fill: "green", shape: "dot", text: "online" });
|
|
46
|
+
})
|
|
47
|
+
.catch(err => {
|
|
48
|
+
this.error("Error on update capability state: " + err.message);
|
|
49
|
+
this.status({ fill: "red", shape: "dot", text: "Error" });
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
if (device.initState)
|
|
53
|
+
init();
|
|
54
|
+
device.on("online", () => {
|
|
55
|
+
init();
|
|
56
|
+
});
|
|
57
|
+
device.on("offline", () => {
|
|
58
|
+
this.status({ fill: "red", shape: "dot", text: "offline" });
|
|
59
|
+
});
|
|
60
|
+
device.on(id, () => {
|
|
61
|
+
device.updateCapabState(id, curentState)
|
|
62
|
+
.then(() => {
|
|
63
|
+
const str_url = stream_url.slice(0, 25) + "...";
|
|
64
|
+
this.status({ fill: "green", shape: "dot", text: str_url });
|
|
65
|
+
})
|
|
66
|
+
.catch(err => {
|
|
67
|
+
this.error("Error on update capability state: " + err.message);
|
|
68
|
+
this.status({ fill: "red", shape: "dot", text: "Error" });
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
this.on('close', (removed, done) => {
|
|
72
|
+
device.setMaxListeners(device.getMaxListeners() - 1);
|
|
73
|
+
if (removed) {
|
|
74
|
+
device.delCapability(id)
|
|
75
|
+
.then(() => { done(); })
|
|
76
|
+
.catch(err => {
|
|
77
|
+
this.error("Error on delete capability: " + err.message);
|
|
78
|
+
done();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
done();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
RED.nodes.registerType("Video", AliceVideo);
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=alice-video.js.map
|
package/nodes/alice.js
CHANGED
|
@@ -4,9 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
const axios_1 = __importDefault(require("axios"));
|
|
6
6
|
const mqtt_1 = __importDefault(require("mqtt"));
|
|
7
|
-
;
|
|
8
|
-
;
|
|
9
|
-
;
|
|
10
7
|
module.exports = (RED) => {
|
|
11
8
|
function AliceService(config) {
|
|
12
9
|
RED.nodes.createNode(this, config);
|
|
@@ -16,8 +13,8 @@ module.exports = (RED) => {
|
|
|
16
13
|
const password = this.credentials.password;
|
|
17
14
|
const token = this.credentials.token;
|
|
18
15
|
const suburl = Buffer.from(email).toString('base64');
|
|
19
|
-
RED.httpAdmin.get("/noderedhome/" + suburl + "/clearalldevice", (
|
|
20
|
-
|
|
16
|
+
RED.httpAdmin.get("/noderedhome/" + suburl + "/clearalldevice", (_req, res) => {
|
|
17
|
+
axios_1.default.request({
|
|
21
18
|
method: 'POST',
|
|
22
19
|
url: 'https://api.nodered-home.ru/gtw/device/clearallconfigs',
|
|
23
20
|
headers: {
|
|
@@ -25,9 +22,8 @@ module.exports = (RED) => {
|
|
|
25
22
|
'Authorization': "Bearer " + this.getToken()
|
|
26
23
|
},
|
|
27
24
|
data: {}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.then(result => {
|
|
25
|
+
})
|
|
26
|
+
.then(() => {
|
|
31
27
|
this.trace("All devices configs deleted on gateway successfully");
|
|
32
28
|
res.sendStatus(200);
|
|
33
29
|
})
|
|
@@ -36,16 +32,15 @@ module.exports = (RED) => {
|
|
|
36
32
|
res.sendStatus(500);
|
|
37
33
|
});
|
|
38
34
|
});
|
|
39
|
-
RED.httpAdmin.get("/noderedhome/" + this.id + "/getfullconfig", (
|
|
40
|
-
|
|
35
|
+
RED.httpAdmin.get("/noderedhome/" + this.id + "/getfullconfig", (_req, res) => {
|
|
36
|
+
axios_1.default.request({
|
|
41
37
|
method: 'GET',
|
|
42
38
|
url: 'https://api.iot.yandex.net/v1.0/user/info',
|
|
43
39
|
headers: {
|
|
44
40
|
'content-type': 'application/json',
|
|
45
41
|
'Authorization': "Bearer " + this.getToken()
|
|
46
42
|
}
|
|
47
|
-
}
|
|
48
|
-
axios_1.default.request(option)
|
|
43
|
+
})
|
|
49
44
|
.then(result => {
|
|
50
45
|
this.trace("Full Alice SmartHome config successfully retrieved");
|
|
51
46
|
res.json(result.data);
|
|
@@ -60,7 +55,6 @@ module.exports = (RED) => {
|
|
|
60
55
|
this.error("Authentication is required!!!");
|
|
61
56
|
return;
|
|
62
57
|
}
|
|
63
|
-
;
|
|
64
58
|
const mqttClient = mqtt_1.default.connect("mqtts://mqtt.cloud.yandex.net", {
|
|
65
59
|
port: 8883,
|
|
66
60
|
clientId: login,
|
|
@@ -71,7 +65,7 @@ module.exports = (RED) => {
|
|
|
71
65
|
});
|
|
72
66
|
mqttClient.on("message", (topic, payload) => {
|
|
73
67
|
const arrTopic = topic.split('/');
|
|
74
|
-
const data = JSON.parse(payload);
|
|
68
|
+
const data = JSON.parse(payload.toString());
|
|
75
69
|
this.trace("Incoming:" + topic + " timestamp:" + new Date().getTime());
|
|
76
70
|
if (payload.length && typeof data === 'object') {
|
|
77
71
|
if (arrTopic[3] == 'message') {
|
|
@@ -80,13 +74,12 @@ module.exports = (RED) => {
|
|
|
80
74
|
else {
|
|
81
75
|
this.emit(arrTopic[3], data);
|
|
82
76
|
}
|
|
83
|
-
;
|
|
84
77
|
}
|
|
85
78
|
});
|
|
86
79
|
mqttClient.on("connect", () => {
|
|
87
80
|
this.debug("Yandex IOT client connected. ");
|
|
88
81
|
this.emit('online');
|
|
89
|
-
mqttClient.subscribe("$me/device/commands/+",
|
|
82
|
+
mqttClient.subscribe("$me/device/commands/+", () => {
|
|
90
83
|
this.debug("Yandex IOT client subscribed to the command");
|
|
91
84
|
});
|
|
92
85
|
});
|
|
@@ -114,7 +107,7 @@ module.exports = (RED) => {
|
|
|
114
107
|
this.on('close', (done) => {
|
|
115
108
|
this.emit('offline');
|
|
116
109
|
setTimeout(() => {
|
|
117
|
-
mqttClient.end(false, done);
|
|
110
|
+
mqttClient.end(false, {}, done);
|
|
118
111
|
}, 500);
|
|
119
112
|
});
|
|
120
113
|
this.send2gate = (path, data, retain) => {
|
|
@@ -125,7 +118,6 @@ module.exports = (RED) => {
|
|
|
125
118
|
return JSON.parse(token).access_token;
|
|
126
119
|
};
|
|
127
120
|
}
|
|
128
|
-
;
|
|
129
121
|
RED.nodes.registerType("alice-service", AliceService, {
|
|
130
122
|
credentials: {
|
|
131
123
|
email: { type: "text" },
|
|
@@ -135,3 +127,4 @@ module.exports = (RED) => {
|
|
|
135
127
|
}
|
|
136
128
|
});
|
|
137
129
|
};
|
|
130
|
+
//# sourceMappingURL=alice.js.map
|
package/nodes/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-alice",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "npm run build && node-red",
|
|
@@ -47,18 +47,13 @@
|
|
|
47
47
|
"mqtt": "^4.3.8"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/axios": "^0.14.0",
|
|
51
|
-
"@types/mqtt": "^2.5.0",
|
|
52
50
|
"@types/node": "^20.11.16",
|
|
53
51
|
"@types/node-red": "^1.3.4",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
55
|
-
"@typescript-eslint/parser": "^6.20.0",
|
|
56
|
-
"eslint": "^8.56.0",
|
|
57
52
|
"nodemon": "^3.0.3",
|
|
58
53
|
"typescript": "^5.3.3"
|
|
59
54
|
},
|
|
60
55
|
"nodemonConfig": {
|
|
61
|
-
"ignoreRoot"
|
|
56
|
+
"ignoreRoot": [".git", "test"],
|
|
62
57
|
"restartable": "rs",
|
|
63
58
|
"ignore": [
|
|
64
59
|
"node_modules/**/node_modules",
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('Color',{
|
|
3
|
+
category: 'alice',
|
|
4
|
+
defaults:{
|
|
5
|
+
device: {value:"", type:"alice-device"},
|
|
6
|
+
name: {value:""},
|
|
7
|
+
color_support:{value:true},
|
|
8
|
+
scheme: {value:"rgb_normal"},
|
|
9
|
+
response:{value:true},
|
|
10
|
+
temperature_k: {value:false},
|
|
11
|
+
temperature_min: {value:2000, validate:function(v){
|
|
12
|
+
let value = parseInt(v);
|
|
13
|
+
return value>=2000;
|
|
14
|
+
}},
|
|
15
|
+
temperature_max: {value:9000, validate:function(v){
|
|
16
|
+
let value = parseInt(v);
|
|
17
|
+
return value<=9000;
|
|
18
|
+
}},
|
|
19
|
+
color_scene: {value:[]}
|
|
20
|
+
},
|
|
21
|
+
inputs:1,
|
|
22
|
+
outputs:3,
|
|
23
|
+
outputLabels: ["color","temperature_k","color_scene"],
|
|
24
|
+
icon: "alice.png",
|
|
25
|
+
color: "#D8BFD8",
|
|
26
|
+
label: function(){
|
|
27
|
+
return this.name + ":Color";
|
|
28
|
+
},
|
|
29
|
+
oneditprepare: function(){
|
|
30
|
+
if (this.response === undefined){
|
|
31
|
+
$( "#node-input-response").prop('checked', true);
|
|
32
|
+
};
|
|
33
|
+
if (this.color_support === undefined){
|
|
34
|
+
$( "#node-input-color_support").prop('checked', true);
|
|
35
|
+
};
|
|
36
|
+
if (this.temperature_min === undefined){
|
|
37
|
+
$('#node-input-temperature_min').val(2000);
|
|
38
|
+
};
|
|
39
|
+
if (this.temperature_max === undefined){
|
|
40
|
+
$('#node-input-temperature_max').val(9000);
|
|
41
|
+
};
|
|
42
|
+
$('#node-input-color_support').on('change',()=>{
|
|
43
|
+
if ($('#node-input-color_support').is(":checked")){
|
|
44
|
+
$('#node-input-scheme').prop('disabled', false);
|
|
45
|
+
}else{
|
|
46
|
+
$('#node-input-scheme').prop('disabled', true);
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
$('#node-input-temperature_k').on('change',()=>{
|
|
50
|
+
if ($('#node-input-temperature_k').is(":checked")){
|
|
51
|
+
$('#node-input-temperature_min').prop('disabled', false);
|
|
52
|
+
$('#node-input-temperature_max').prop('disabled', false);
|
|
53
|
+
}else{
|
|
54
|
+
$('#node-input-temperature_min').prop('disabled', true);
|
|
55
|
+
$('#node-input-temperature_max').prop('disabled', true);
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
updateAllScenes(this.color_scene);
|
|
59
|
+
},
|
|
60
|
+
oneditsave: function(){
|
|
61
|
+
deivcename = $('#node-input-device option:selected').text();
|
|
62
|
+
$('#node-input-name').val(deivcename);
|
|
63
|
+
this.color_scene = getCurrentScenes();
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
function updateAllScenes(scenes){
|
|
67
|
+
deleteAllScenes();
|
|
68
|
+
scenes.forEach((s,i)=>{
|
|
69
|
+
addScene2List(s,i);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
function deleteAllScenes() {
|
|
73
|
+
$('#node-input-color_scene-container').empty();
|
|
74
|
+
};
|
|
75
|
+
function addScene2List(scene,index){
|
|
76
|
+
$('#node-input-color_scene-container').append('<li rel="'+scene+'" class="red-ui-editableList-item-sortable red-ui-editableList-item-removable"><div class="red-ui-editableList-item-content" style="overflow: hidden; white-space: nowrap;"><span>'+scene+'</span></div><a href="#" onclick="delScene('+index+')" class="red-ui-editableList-item-remove red-ui-button red-ui-button-small"><i class="fa fa-remove"></i></a></li>')
|
|
77
|
+
};
|
|
78
|
+
function getCurrentScenes() {
|
|
79
|
+
let scenes = [];
|
|
80
|
+
$('#node-input-color_scene-container li').each(function(){
|
|
81
|
+
scenes.push($(this).attr('rel'));
|
|
82
|
+
});
|
|
83
|
+
return scenes;
|
|
84
|
+
};
|
|
85
|
+
function addScene() {
|
|
86
|
+
let scene = $('#select-custom-scene').find(":selected").val();
|
|
87
|
+
let scenes = getCurrentScenes();
|
|
88
|
+
if (scenes.indexOf(scene)>-1){
|
|
89
|
+
return;
|
|
90
|
+
}else{
|
|
91
|
+
scenes.push(scene);
|
|
92
|
+
updateAllScenes(scenes);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
function delScene(index) {
|
|
96
|
+
let scenes = getCurrentScenes();
|
|
97
|
+
scenes.splice(index, 1);
|
|
98
|
+
updateAllScenes(scenes);
|
|
99
|
+
};
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<script type="text/x-red" data-template-name="Color">
|
|
103
|
+
<input type="hidden" id="node-input-name">
|
|
104
|
+
<div class="form-row" style="border-bottom: 1px solid #ddd; padding-bottom: 12px;">
|
|
105
|
+
<label for="node-input-device">Device</label>
|
|
106
|
+
<input id="node-input-device">
|
|
107
|
+
</div>
|
|
108
|
+
<div class="form-row" style="border-bottom: 1px solid #ddd; padding-bottom: 12px;">
|
|
109
|
+
<label for="node-input-color_support"><span >Color</span></label>
|
|
110
|
+
<label for="node-input-color_support" style="width:70%">
|
|
111
|
+
<input type="checkbox" id="node-input-color_support" style="display:inline-block; width:22px; vertical-align:baseline;" autocomplete="off"><span> supports color change</span>
|
|
112
|
+
</label>
|
|
113
|
+
<label for="node-input-scheme">Scheme</label>
|
|
114
|
+
<select id="node-input-scheme" style="width: 70%;">
|
|
115
|
+
<option value="rgb_normal">RGB</option>
|
|
116
|
+
<!-- <option value="rgb">RGB (24bit)</option> -->
|
|
117
|
+
<option value="hsv">HSV</option>
|
|
118
|
+
</select>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="form-row" style="border-bottom: 1px solid #ddd; padding-bottom: 12px;">
|
|
121
|
+
<label for="node-input-temperature_k"><span>Wite Temp</span></label>
|
|
122
|
+
<label for="node-input-temperature_k" style="width:70%">
|
|
123
|
+
<input type="checkbox" id="node-input-temperature_k" style="display:inline-block; width:22px; vertical-align:baseline;" autocomplete="off">
|
|
124
|
+
<span> white temperature support</span>
|
|
125
|
+
</label>
|
|
126
|
+
<div>
|
|
127
|
+
<label for="node-input-temperature_x"><span>Temp Range</span></label>
|
|
128
|
+
<span style="padding-left: 4px;"> Min</span>
|
|
129
|
+
<input id="node-input-temperature_min" type="number" style="width: 70px;">
|
|
130
|
+
<span> K</span>
|
|
131
|
+
<span style="padding-left: 10px;"> Max</span>
|
|
132
|
+
<input id="node-input-temperature_max" type="number" style="width: 70px;">
|
|
133
|
+
<span> K</span>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div class="form-row node-input-rule-container-row" style="border-bottom: 1px solid #ddd; padding-bottom: 12px;">
|
|
138
|
+
<label for="node-input-color_scene" style="width:auto">Supported color scenes</label>
|
|
139
|
+
<div class="red-ui-editableList">
|
|
140
|
+
<div class="red-ui-editableList-border red-ui-editableList-container" style="min-height: 150px; max-height: none; overflow-y: scroll; height: 308.4px;">
|
|
141
|
+
<ol id="node-input-color_scene-container" class="red-ui-editableList-list" style="min-height: 100px; min-width: 150px; ">
|
|
142
|
+
<li class="red-ui-editableList-item-sortable red-ui-editableList-item-removable">
|
|
143
|
+
<div class="red-ui-editableList-item-content" style="overflow: hidden; white-space: nowrap;">
|
|
144
|
+
<span>Tets</span>
|
|
145
|
+
</div>
|
|
146
|
+
<i class="red-ui-editableList-item-handle fa fa-bullhorn" style="cursor:auto"></i><a href="#" class="red-ui-editableList-item-remove red-ui-button red-ui-button-small"><i class="fa fa-remove"></i></a>
|
|
147
|
+
</li>
|
|
148
|
+
<li class="red-ui-editableList-item-sortable red-ui-editableList-item-removable">
|
|
149
|
+
<div class="red-ui-editableList-item-content" style="overflow: hidden; white-space: nowrap;">
|
|
150
|
+
<span>Tets2</span>
|
|
151
|
+
</div>
|
|
152
|
+
<i class="red-ui-editableList-item-handle fa fa-bullhorn" style="cursor:auto"></i><a href="#" class="red-ui-editableList-item-remove red-ui-button red-ui-button-small"><i class="fa fa-remove"></i></a>
|
|
153
|
+
</li>
|
|
154
|
+
</ol>
|
|
155
|
+
</div>
|
|
156
|
+
<div style="margin-top:4px">
|
|
157
|
+
<select id="select-custom-scene">
|
|
158
|
+
<option value="alarm">alarm</option>
|
|
159
|
+
<option value="alice">alice</option>
|
|
160
|
+
<option value="candle">candle</option>
|
|
161
|
+
<option value="dinner">dinner</option>
|
|
162
|
+
<option value="fantasy">fantasy</option>
|
|
163
|
+
<option value="garland">garland</option>
|
|
164
|
+
<option value="jungle">jungle</option>
|
|
165
|
+
<option value="movie">movie</option>
|
|
166
|
+
<option value="neon">neon</option>
|
|
167
|
+
<option value="night">night</option>
|
|
168
|
+
<option value="ocean">ocean</option>
|
|
169
|
+
<option value="party">party</option>
|
|
170
|
+
<option value="reading">reading</option>
|
|
171
|
+
<option value="rest">rest</option>
|
|
172
|
+
<option value="romance">romance</option>
|
|
173
|
+
<option value="siren">siren</option>
|
|
174
|
+
<option value="sunrise">sunrise</option>
|
|
175
|
+
<option value="sunset">sunset</option>
|
|
176
|
+
</select>
|
|
177
|
+
<a id="button-addScene" href="#" class="red-ui-button" onclick="addScene()" style="margin-top: 4px;"><i class="fa fa-plus"></i></a>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div class="form-row">
|
|
183
|
+
<label for="node-input-response"><i class="fa fa-refresh"></i> <span >Response</span></label>
|
|
184
|
+
<label for="node-input-response" style="width:70%">
|
|
185
|
+
<input type="checkbox" id="node-input-response" style="display:inline-block; width:22px; vertical-align:baseline;" autocomplete="off"><span>Always answer Alice with success</span>
|
|
186
|
+
</label>
|
|
187
|
+
</div>
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<script type="text/x-red" data-help-name="Color">
|
|
191
|
+
<p>Change the color of their luminous elements to any one from the HSV model or from the RGB model;</p>
|
|
192
|
+
|
|
193
|
+
<h3>Property</h3>
|
|
194
|
+
<dl class="message-properties">
|
|
195
|
+
<dt>Device
|
|
196
|
+
<span class="property-type">Select</span>
|
|
197
|
+
</dt>
|
|
198
|
+
<dd> The device to which this feature is connected </dd>
|
|
199
|
+
<dt>Color Scheme
|
|
200
|
+
<span class="property-type">Select</span>
|
|
201
|
+
</dt>
|
|
202
|
+
<dd> Color scheme selection (RGB or HSV) </dd>
|
|
203
|
+
<dt>White temperature support
|
|
204
|
+
<span class="property-type">Integer</span>
|
|
205
|
+
</dt>
|
|
206
|
+
<dd>White temperature support, min and max value in Kelvin</dd>
|
|
207
|
+
<dd>Min value must be above 2000 kelvin</dd>
|
|
208
|
+
<dd>Max value must be below 9000 kelvin</dd>
|
|
209
|
+
<dt>Supported color scenes
|
|
210
|
+
<span class="property-type">array of strings</span>
|
|
211
|
+
</dt>
|
|
212
|
+
<dd>List of supported color scenes</dd>
|
|
213
|
+
<dt>Response
|
|
214
|
+
<span class="property-type">checkbox</span>
|
|
215
|
+
</dt>
|
|
216
|
+
<dd> In order for the device to respond to Alice that the command was successful, the corresponding value should arrive at the input within 2.5 seconds.
|
|
217
|
+
If your device takes longer or doesn’t return a confirmation at all, just check this box. </dd>
|
|
218
|
+
</dl>
|
|
219
|
+
|
|
220
|
+
<h3>Inputs</h3>
|
|
221
|
+
<dl class="message-properties">
|
|
222
|
+
<dt>payload
|
|
223
|
+
<span class="property-type">Object || Integer || String</span>
|
|
224
|
+
</dt>
|
|
225
|
+
<dd> If you want to set the color, msg.payload must be RGB or HSV Object </br><i>{r,g,b} or {h,s,v}</i></dd>
|
|
226
|
+
<dd> If you want white temperature, msg.payload must be Integer >=MIN and <=MAX</dd>
|
|
227
|
+
<dd> If you want to set the color scene, the msg.payload must be String set in the settings</dd>
|
|
228
|
+
</dl>
|
|
229
|
+
|
|
230
|
+
<h3>Outputs 1</h3>
|
|
231
|
+
<dl class="message-properties">
|
|
232
|
+
<dt>payload
|
|
233
|
+
<span class="property-type">Object</span>
|
|
234
|
+
</dt>
|
|
235
|
+
<dd> RGB or HSV Object </br><i>{r,g,b} or {h,s,v}</i></dd>
|
|
236
|
+
</dl>
|
|
237
|
+
<h3>Outputs 2</h3>
|
|
238
|
+
<dl class="message-properties">
|
|
239
|
+
<dt>payload
|
|
240
|
+
<span class="property-type">Integer</span>
|
|
241
|
+
</dt>
|
|
242
|
+
<dd> White temperature in Kelvin</dd>
|
|
243
|
+
</dl>
|
|
244
|
+
<h3>Outputs 3</h3>
|
|
245
|
+
<dl class="message-properties">
|
|
246
|
+
<dt>payload
|
|
247
|
+
<span class="property-type">String</span>
|
|
248
|
+
</dt>
|
|
249
|
+
<dd> Color scene text name</dd>
|
|
250
|
+
</dl>
|
|
251
|
+
<h3>References</h3>
|
|
252
|
+
<ul>
|
|
253
|
+
<li><a href="https://yandex.ru/dev/dialogs/alice/doc/smart-home/concepts/color_setting-docpage/"> Yandex documentation</a></li>
|
|
254
|
+
</ul>
|
|
255
|
+
</script>
|