node-red-contrib-alice 2.2.5 → 2.3.2
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 +101 -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 +103 -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
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('Event',{
|
|
3
|
+
category: 'alice',
|
|
4
|
+
defaults:{
|
|
5
|
+
device: {value:"", type:"alice-device"},
|
|
6
|
+
name: {value:"Event"},
|
|
7
|
+
stype: {value:'devices.properties.event'},
|
|
8
|
+
instance: {value:undefined, validate: (v)=>{
|
|
9
|
+
if (v){
|
|
10
|
+
return true;
|
|
11
|
+
}else{
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}},
|
|
15
|
+
events:{value:[]}
|
|
16
|
+
},
|
|
17
|
+
inputs:1,
|
|
18
|
+
outputs:0,
|
|
19
|
+
icon: "alice.png",
|
|
20
|
+
color: "#D8BFD8",
|
|
21
|
+
label: function(){
|
|
22
|
+
return this.name;
|
|
23
|
+
},
|
|
24
|
+
oneditprepare: function(){
|
|
25
|
+
$("#node-input-instance").typedInput({
|
|
26
|
+
types: [
|
|
27
|
+
{
|
|
28
|
+
options: [
|
|
29
|
+
{ value: "vibration", label: "Vibration"},
|
|
30
|
+
{ value: "open", label: "Open"},
|
|
31
|
+
{ value: "button", label: "Button"},
|
|
32
|
+
{ value: "motion", label: "Motion"},
|
|
33
|
+
{ value: "smoke", label: "Smoke"},
|
|
34
|
+
{ value: "gas", label: "Gas"},
|
|
35
|
+
{ value: "battery_level", label: "Battery level"},
|
|
36
|
+
{ value: "water_level", label: "Water level"},
|
|
37
|
+
{ value: "water_leak", label: "Water leak"}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
$('#node-input-instance').on('change',()=>{
|
|
43
|
+
let val= $("#node-input-instance").val();
|
|
44
|
+
$("#node-input-eventslist").editableList('empty');
|
|
45
|
+
|
|
46
|
+
switch (val) {
|
|
47
|
+
case "vibration":
|
|
48
|
+
$("#node-input-eventslist").editableList('addItems',["tilt","fall","vibration"]);
|
|
49
|
+
break;
|
|
50
|
+
case "open":
|
|
51
|
+
$("#node-input-eventslist").editableList('addItems',["opened","closed"]);
|
|
52
|
+
break;
|
|
53
|
+
case "button":
|
|
54
|
+
$("#node-input-eventslist").editableList('addItems',["click","double_click","long_press"]);
|
|
55
|
+
break;
|
|
56
|
+
case "motion":
|
|
57
|
+
$("#node-input-eventslist").editableList('addItems',["detected","not_detected"]);
|
|
58
|
+
break;
|
|
59
|
+
case "smoke":
|
|
60
|
+
$("#node-input-eventslist").editableList('addItems',["detected","not_detected","high"]);
|
|
61
|
+
break;
|
|
62
|
+
case "gas":
|
|
63
|
+
$("#node-input-eventslist").editableList('addItems',["detected","not_detected","high"]);
|
|
64
|
+
break;
|
|
65
|
+
case "battery_level":
|
|
66
|
+
$("#node-input-eventslist").editableList('addItems',["low","normal"]);
|
|
67
|
+
break;
|
|
68
|
+
case "water_level":
|
|
69
|
+
$("#node-input-eventslist").editableList('addItems',["low","normal"]);
|
|
70
|
+
break;
|
|
71
|
+
case "water_leak":
|
|
72
|
+
$("#node-input-eventslist").editableList('addItems',["dry","leak"]);
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
$("#node-input-eventslist").editableList({
|
|
79
|
+
addButton: false,
|
|
80
|
+
height: 150,
|
|
81
|
+
addItem: function(container,i,opt){
|
|
82
|
+
var row = $('<div style="padding-left: 3px; class="event_name">'+opt+'</div>').appendTo(container);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
oneditsave: function(){
|
|
87
|
+
deivcename = $('#node-input-device option:selected').text();
|
|
88
|
+
instance = $("#node-input-instance").val();
|
|
89
|
+
$('#node-input-name').val(deivcename+":"+instance);
|
|
90
|
+
let events = $("#node-input-eventslist").editableList('items');
|
|
91
|
+
let node = this;
|
|
92
|
+
node.events= [];
|
|
93
|
+
events.each(function(i) {
|
|
94
|
+
let name = $(this).text();
|
|
95
|
+
node.events.push(name);
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<script type="text/x-red" data-template-name="Event">
|
|
102
|
+
<input type="hidden" id="node-input-name">
|
|
103
|
+
<div class="form-row">
|
|
104
|
+
<label for="node-input-device">Device</label>
|
|
105
|
+
<input id="node-input-device">
|
|
106
|
+
</div>
|
|
107
|
+
<div class="form-row">
|
|
108
|
+
<label for="node-input-instance">Event Type</label>
|
|
109
|
+
<input type="text" id="node-input-instance">
|
|
110
|
+
</div>
|
|
111
|
+
<div class="form-row node-input-rule-container-row">
|
|
112
|
+
<label for="node-input-modes" style="width:auto">Supported events</label>
|
|
113
|
+
<ol id="node-input-eventslist"></ol>
|
|
114
|
+
</div>
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<script type="text/x-red" data-help-name="Event">
|
|
118
|
+
<p>Transmits event from sensors built into the device.</p>
|
|
119
|
+
|
|
120
|
+
<h3>Property</h3>
|
|
121
|
+
<dl class="message-properties">
|
|
122
|
+
<dt>Device
|
|
123
|
+
<span class="property-type">Select</span>
|
|
124
|
+
</dt>
|
|
125
|
+
<dd> The device to which this sensor is connected </dd>
|
|
126
|
+
<dt>Event Type
|
|
127
|
+
<span class="property-type">Select</span>
|
|
128
|
+
</dt>
|
|
129
|
+
<dd>a type of event that helps to better understand the area of its use and the data it collects</dd>
|
|
130
|
+
<dt>Supported events
|
|
131
|
+
<span class="property-type">Read only</span>
|
|
132
|
+
</dt>
|
|
133
|
+
<dd>list of events that the sensor can send</dd>
|
|
134
|
+
</dl>
|
|
135
|
+
|
|
136
|
+
<h3>Inputs</h3>
|
|
137
|
+
<dl class="message-properties">
|
|
138
|
+
<dt>payload
|
|
139
|
+
<span class="property-type">string</span>
|
|
140
|
+
</dt>
|
|
141
|
+
<dd>events can only be from the allowed list</dd>
|
|
142
|
+
</dl>
|
|
143
|
+
|
|
144
|
+
<h3>References</h3>
|
|
145
|
+
<ul>
|
|
146
|
+
<li><a href="https://yandex.ru/dev/dialogs/smart-home/doc/concepts/event.html"> - Yandex documentation</a></li>
|
|
147
|
+
</ul>
|
|
148
|
+
</script>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { NodeAPI, Node } from "node-red";
|
|
2
|
+
import { AliceEventConfig, AliceDeviceNode, SensorState } from "./types.js";
|
|
3
|
+
|
|
4
|
+
export = (RED: NodeAPI): void => {
|
|
5
|
+
function AliceEvent(this: Node, config: AliceEventConfig): void {
|
|
6
|
+
RED.nodes.createNode(this, config);
|
|
7
|
+
const device = RED.nodes.getNode(config.device) as AliceDeviceNode;
|
|
8
|
+
device.setMaxListeners(device.getMaxListeners() + 1);
|
|
9
|
+
|
|
10
|
+
const id = JSON.parse(JSON.stringify(this.id));
|
|
11
|
+
const stype = 'devices.properties.event';
|
|
12
|
+
const instance = config.instance;
|
|
13
|
+
const events = config.events;
|
|
14
|
+
let initState = false;
|
|
15
|
+
|
|
16
|
+
const curentState: SensorState = {
|
|
17
|
+
type: stype,
|
|
18
|
+
state: {
|
|
19
|
+
instance: instance,
|
|
20
|
+
value: ''
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
this.status({ fill: "red", shape: "dot", text: "offline" });
|
|
25
|
+
|
|
26
|
+
const init = (): void => {
|
|
27
|
+
this.debug("Starting sensor initilization ...");
|
|
28
|
+
const objEvents = events.map(v => ({ value: v }));
|
|
29
|
+
const sensor = {
|
|
30
|
+
type: stype,
|
|
31
|
+
reportable: true,
|
|
32
|
+
retrievable: false,
|
|
33
|
+
parameters: {
|
|
34
|
+
instance: instance,
|
|
35
|
+
events: objEvents
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
device.setSensor(id, sensor)
|
|
40
|
+
.then(() => {
|
|
41
|
+
this.debug("Sensor initilization - success!");
|
|
42
|
+
this.status({ fill: "green", shape: "dot", text: "online" });
|
|
43
|
+
initState = true;
|
|
44
|
+
})
|
|
45
|
+
.catch(err => {
|
|
46
|
+
this.error("Error on create sensor: " + err.message);
|
|
47
|
+
this.status({ fill: "red", shape: "dot", text: "error" });
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (device.initState) init();
|
|
52
|
+
|
|
53
|
+
device.on("online", () => {
|
|
54
|
+
if (!initState) {
|
|
55
|
+
init();
|
|
56
|
+
} else {
|
|
57
|
+
this.status({ fill: "green", shape: "dot", text: curentState.state.value });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
device.on("offline", () => {
|
|
62
|
+
this.status({ fill: "red", shape: "dot", text: "offline" });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
this.on('input', (msg, _send, done) => {
|
|
66
|
+
if (!events.includes(msg.payload as string)) {
|
|
67
|
+
this.error("Wrong type! msg.payload must be from the list of allowed events.");
|
|
68
|
+
if (done) { done(); }
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (curentState.state.value == msg.payload) {
|
|
72
|
+
this.debug("Value not changed. Cancel update");
|
|
73
|
+
if (done) { done(); }
|
|
74
|
+
return;
|
|
75
|
+
} else {
|
|
76
|
+
curentState.state.value = msg.payload;
|
|
77
|
+
}
|
|
78
|
+
// для кнопок обнуляем значение через 1 сек
|
|
79
|
+
if (instance == 'button') {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
curentState.state.value = null;
|
|
82
|
+
this.status({ fill: "green", shape: "dot", text: "" });
|
|
83
|
+
}, 1000);
|
|
84
|
+
}
|
|
85
|
+
device.updateSensorState(id, curentState)
|
|
86
|
+
.then(() => {
|
|
87
|
+
this.status({ fill: "green", shape: "dot", text: curentState.state.value });
|
|
88
|
+
if (done) { done(); }
|
|
89
|
+
})
|
|
90
|
+
.catch(err => {
|
|
91
|
+
this.error("Error on update sensor state: " + err.message);
|
|
92
|
+
this.status({ fill: "red", shape: "dot", text: "Error" });
|
|
93
|
+
if (done) { done(); }
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
this.on('close', (removed: boolean, done: () => void) => {
|
|
98
|
+
if (removed) {
|
|
99
|
+
device.delSensor(id)
|
|
100
|
+
.then(() => { done(); })
|
|
101
|
+
.catch(err => {
|
|
102
|
+
this.error("Error on delete property: " + err.message);
|
|
103
|
+
done();
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
done();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
RED.nodes.registerType("Event", AliceEvent);
|
|
112
|
+
};
|
package/src/alice-get.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import {NodeAPI, Node, NodeDef } from "node-red";
|
|
2
|
-
import axios from "axios";
|
|
1
|
+
import { NodeAPI, Node, NodeDef } from "node-red";
|
|
3
2
|
|
|
3
|
+
interface NodeAliceGetConfig extends NodeDef {
|
|
4
|
+
service: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export = (RED: NodeAPI):void =>{
|
|
12
|
-
function AliceGet(this:Node, config:NodeAliceGetConfig):void {
|
|
13
|
-
RED.nodes.createNode(this,config);
|
|
14
|
-
const service = RED.nodes.getNode(config.service);
|
|
15
|
-
};
|
|
8
|
+
export = (RED: NodeAPI): void => {
|
|
9
|
+
function AliceGet(this: Node, config: NodeAliceGetConfig): void {
|
|
10
|
+
RED.nodes.createNode(this, config);
|
|
11
|
+
const _service = RED.nodes.getNode(config.service);
|
|
12
|
+
}
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
}
|
|
14
|
+
RED.nodes.registerType("Alice-Get", AliceGet);
|
|
15
|
+
};
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('Mode',{
|
|
3
|
+
category: 'alice',
|
|
4
|
+
defaults:{
|
|
5
|
+
device: {value:"", type:"alice-device"},
|
|
6
|
+
name: {value:""},
|
|
7
|
+
instance: { value:null, validate: (v)=>{
|
|
8
|
+
if (v){
|
|
9
|
+
return true;
|
|
10
|
+
}else{
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}},
|
|
14
|
+
modes:{value:[], validate:(ms)=>{
|
|
15
|
+
return ms.length > 0
|
|
16
|
+
}},
|
|
17
|
+
response:{value:true}
|
|
18
|
+
},
|
|
19
|
+
inputs:1,
|
|
20
|
+
outputs:1,
|
|
21
|
+
icon: "alice.png",
|
|
22
|
+
color: "#D8BFD8",
|
|
23
|
+
label: function(){
|
|
24
|
+
return this.name + ":" + this.instance;
|
|
25
|
+
},
|
|
26
|
+
oneditsave: function(){
|
|
27
|
+
deivcename = $('#node-input-device option:selected').text();
|
|
28
|
+
$('#node-input-name').val(deivcename);
|
|
29
|
+
currentInstance = $('#node-input-instance').val();
|
|
30
|
+
if (currentInstance=='multicooker_mode'){
|
|
31
|
+
$('#node-input-instance option[value=program]').prop('selected', true);
|
|
32
|
+
};
|
|
33
|
+
this.modes = getCurrentModes();
|
|
34
|
+
},
|
|
35
|
+
oneditprepare: function(){
|
|
36
|
+
var firstRun = true;
|
|
37
|
+
$('#node-input-instance').on('change',()=>{
|
|
38
|
+
var val = $('#node-input-instance').find(":selected").val();
|
|
39
|
+
if (firstRun){
|
|
40
|
+
firstRun=false;
|
|
41
|
+
return;
|
|
42
|
+
};
|
|
43
|
+
switch (val) {
|
|
44
|
+
case 'cleanup_mode':
|
|
45
|
+
this.modes = ['auto','eco','express','normal','quiet']
|
|
46
|
+
break;
|
|
47
|
+
case 'coffee_mode':
|
|
48
|
+
this.modes = ['americano','cappuccino','double_espresso','espresso','latte']
|
|
49
|
+
break;
|
|
50
|
+
case 'multicooker_mode':
|
|
51
|
+
this.modes = ['vacuum','boiling','baking','dessert','baby_food','fowl','frying','yogurt','cereals','macaroni','milk_porridge','multicooker','steam','pasta','pizza','pilaf','sauce','soup','stewing','slow_cook','deep_fryer','bread','aspic','cheesecake','preheat']
|
|
52
|
+
break;
|
|
53
|
+
case 'fan_speed':
|
|
54
|
+
this.modes = ['auto','high','low','medium','turbo']
|
|
55
|
+
break;
|
|
56
|
+
case 'heat':
|
|
57
|
+
this.modes = ['auto','max','min','normal','turbo']
|
|
58
|
+
break;
|
|
59
|
+
case 'input_source':
|
|
60
|
+
this.modes = ['one','two','three','four','five','six','seven','eight','nine','ten']
|
|
61
|
+
break;
|
|
62
|
+
case 'program':
|
|
63
|
+
this.modes = ['auto','express','one','two','three','four','five','six','seven','eight','nine','ten']
|
|
64
|
+
break;
|
|
65
|
+
case 'swing':
|
|
66
|
+
this.modes = ['auto','horizontal','stationary','vertical']
|
|
67
|
+
break;
|
|
68
|
+
case 'thermostat':
|
|
69
|
+
this.modes = ['auto','cool','dry','fan_only','heat','preheat']
|
|
70
|
+
break;
|
|
71
|
+
case 'work_speed':
|
|
72
|
+
this.modes = ['auto','fast','max','medium','min','slow','turbo']
|
|
73
|
+
break;
|
|
74
|
+
case 'tea_mode':
|
|
75
|
+
this.modes = ['black_tea','flower_tea','green_tea','herbal_tea','oolong_tea','puerh_tea','red_tea','white_tea']
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
this.modes = [];
|
|
79
|
+
break;
|
|
80
|
+
};
|
|
81
|
+
updateAllModes(this.modes);
|
|
82
|
+
});
|
|
83
|
+
updateAllModes(this.modes);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
function updateAllModes(modes){
|
|
87
|
+
deleteAllMode();
|
|
88
|
+
modes.forEach((m,i)=>{
|
|
89
|
+
addMode2List(m,i);
|
|
90
|
+
});
|
|
91
|
+
if (modes.length<1){
|
|
92
|
+
$('#node-input-modes-container').parent().css('border-color', "rgb(214, 97, 95)")
|
|
93
|
+
}else{
|
|
94
|
+
$('#node-input-modes-container').parent().css('border-color', "")
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
function addMode2List(mode,index){
|
|
98
|
+
$('#node-input-modes-container').append('<li rel="'+mode+'" 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>'+mode+'</span></div><a href="#" onclick="delMode('+index+')" class="red-ui-editableList-item-remove red-ui-button red-ui-button-small"><i class="fa fa-remove"></i></a></li>')
|
|
99
|
+
};
|
|
100
|
+
function deleteAllMode() {
|
|
101
|
+
$('#node-input-modes-container').empty();
|
|
102
|
+
};
|
|
103
|
+
function delMode(index) {
|
|
104
|
+
var modes = getCurrentModes();
|
|
105
|
+
modes.splice(index, 1);
|
|
106
|
+
updateAllModes(modes);
|
|
107
|
+
};
|
|
108
|
+
function addMode() {
|
|
109
|
+
var mode = $('#select-custom-mode').find(":selected").val();
|
|
110
|
+
var modes = getCurrentModes();
|
|
111
|
+
if (modes.indexOf(mode)>-1){
|
|
112
|
+
return;
|
|
113
|
+
}else{
|
|
114
|
+
modes.push(mode);
|
|
115
|
+
updateAllModes(modes);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
function getCurrentModes() {
|
|
119
|
+
var modes = [];
|
|
120
|
+
$('#node-input-modes-container li').each(function(){
|
|
121
|
+
modes.push($(this).attr('rel'));
|
|
122
|
+
});
|
|
123
|
+
return modes;
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<script type="text/x-red" data-template-name="Mode">
|
|
128
|
+
<input type="hidden" id="node-input-name">
|
|
129
|
+
<div class="form-row">
|
|
130
|
+
<label for="node-input-device">Device</label>
|
|
131
|
+
<input id="node-input-device">
|
|
132
|
+
</div>
|
|
133
|
+
<div class="form-row">
|
|
134
|
+
<label for="node-input-instance">Mode Type</label>
|
|
135
|
+
<select id="node-input-instance" style="width: 70%;">
|
|
136
|
+
<option value="cleanup_mode">Cleanup mode</option>
|
|
137
|
+
<option value="coffee_mode">Coffee mode</option>
|
|
138
|
+
<option value="multicooker_mode">Multicooker Mode</option>
|
|
139
|
+
<option value="tea_mode">Tea Mode</option>
|
|
140
|
+
<option value="fan_speed">Fan speed</option>
|
|
141
|
+
<option value="heat">Heat Mode</option>
|
|
142
|
+
<option value="input_source">Input source</option>
|
|
143
|
+
<option value="program">Program</option>
|
|
144
|
+
<option value="swing">Swing Mode</option>
|
|
145
|
+
<option value="thermostat">Thermostat</option>
|
|
146
|
+
<option value="work_speed">Work speed</option>
|
|
147
|
+
</select>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="form-row node-input-rule-container-row">
|
|
150
|
+
<label for="node-input-modes" style="width:auto">Supported commands</label>
|
|
151
|
+
<div class="red-ui-editableList">
|
|
152
|
+
<div class="red-ui-editableList-border red-ui-editableList-container" style="min-height: 150px; max-height: none; overflow-y: scroll; height: 308.4px;">
|
|
153
|
+
<ol id="node-input-modes-container" class="red-ui-editableList-list" style="min-height: 0px; min-width: 450px; height: auto;">
|
|
154
|
+
<li class="red-ui-editableList-item-sortable red-ui-editableList-item-removable">
|
|
155
|
+
<div class="red-ui-editableList-item-content" style="overflow: hidden; white-space: nowrap;">
|
|
156
|
+
<span>Tets</span>
|
|
157
|
+
</div>
|
|
158
|
+
<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>
|
|
159
|
+
</li>
|
|
160
|
+
<li class="red-ui-editableList-item-sortable red-ui-editableList-item-removable">
|
|
161
|
+
<div class="red-ui-editableList-item-content" style="overflow: hidden; white-space: nowrap;">
|
|
162
|
+
<span>Tets2</span>
|
|
163
|
+
</div>
|
|
164
|
+
<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>
|
|
165
|
+
</li>
|
|
166
|
+
</ol>
|
|
167
|
+
</div>
|
|
168
|
+
<div style="margin-top:4px">
|
|
169
|
+
<select id="select-custom-mode">
|
|
170
|
+
<option value="auto">auto</option>
|
|
171
|
+
<option value="eco">eco</option>
|
|
172
|
+
<option value="turbo">turbo</option>
|
|
173
|
+
<option value="cool">cool</option>
|
|
174
|
+
<option value="dry">dry</option>
|
|
175
|
+
<option value="fan_only">fan_only</option>
|
|
176
|
+
<option value="heat">heat</option>
|
|
177
|
+
<option value="preheat">preheat</option>
|
|
178
|
+
<option value="high">high</option>
|
|
179
|
+
<option value="low">low</option>
|
|
180
|
+
<option value="medium">medium</option>
|
|
181
|
+
<option value="max">max</option>
|
|
182
|
+
<option value="min">min</option>
|
|
183
|
+
<option value="fast">fast</option>
|
|
184
|
+
<option value="slow">slow</option>
|
|
185
|
+
<option value="express">express</option>
|
|
186
|
+
<option value="normal">normal</option>
|
|
187
|
+
<option value="quiet">quiet</option>
|
|
188
|
+
<option value="horizontal">horizontal</option>
|
|
189
|
+
<option value="stationary">stationary</option>
|
|
190
|
+
<option value="vertical">vertical</option>
|
|
191
|
+
<option value="americano">americano</option>
|
|
192
|
+
<option value="cappuccino">cappuccino</option>
|
|
193
|
+
<option value="double_espresso">double_espresso</option>
|
|
194
|
+
<option value="espresso">espresso</option>
|
|
195
|
+
<option value="latte">latte</option>
|
|
196
|
+
<option value="one">one</option>
|
|
197
|
+
<option value="two">two</option>
|
|
198
|
+
<option value="three">three</option>
|
|
199
|
+
<option value="four">four</option>
|
|
200
|
+
<option value="five">five</option>
|
|
201
|
+
<option value="six">six</option>
|
|
202
|
+
<option value="seven">seven</option>
|
|
203
|
+
<option value="eight">eight</option>
|
|
204
|
+
<option value="nine">nine</option>
|
|
205
|
+
<option value="ten">ten</option>
|
|
206
|
+
<option value="vacuum">vacuum</option>
|
|
207
|
+
<option value="boiling">boiling</option>
|
|
208
|
+
<option value="baking">baking</option>
|
|
209
|
+
<option value="dessert">dessert</option>
|
|
210
|
+
<option value="baby_food">baby_food</option>
|
|
211
|
+
<option value="fowl">fowl</option>
|
|
212
|
+
<option value="frying">frying</option>
|
|
213
|
+
<option value="yogurt">yogurt</option>
|
|
214
|
+
<option value="cereals">cereals</option>
|
|
215
|
+
<option value="macaroni">macaroni</option>
|
|
216
|
+
<option value="milk_porridge">milk_porridge</option>
|
|
217
|
+
<option value="multicooker">multicooker</option>
|
|
218
|
+
<option value="steam">steam</option>
|
|
219
|
+
<option value="pasta">pasta</option>
|
|
220
|
+
<option value="pizza">pizza</option>
|
|
221
|
+
<option value="pilaf">pilaf</option>
|
|
222
|
+
<option value="sauce">sauce</option>
|
|
223
|
+
<option value="soup">soup</option>
|
|
224
|
+
<option value="stewing">stewing</option>
|
|
225
|
+
<option value="slow_cook">slow_cook</option>
|
|
226
|
+
<option value="deep_fryer">deep_fryer</option>
|
|
227
|
+
<option value="bread">bread</option>
|
|
228
|
+
<option value="aspic">aspic</option>
|
|
229
|
+
<option value="cheesecake">cheesecake</option>
|
|
230
|
+
<option value="preheat">preheat</option>
|
|
231
|
+
<option value="black_tea">black_tea</option>
|
|
232
|
+
<option value="flower_tea">flower_tea</option>
|
|
233
|
+
<option value="green_tea">green_tea</option>
|
|
234
|
+
<option value="herbal_tea">herbal_tea</option>
|
|
235
|
+
<option value="oolong_tea">oolong_tea</option>
|
|
236
|
+
<option value="puerh_tea">puerh_tea</option>
|
|
237
|
+
<option value="red_tea">red_tea</option>
|
|
238
|
+
<option value="white_tea">white_tea</option>
|
|
239
|
+
</select>
|
|
240
|
+
<a id="button-addMode" href="#" class="red-ui-button" onclick="addMode()" style="margin-top: 4px;"><i class="fa fa-plus"></i></a>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
<div class="form-row">
|
|
245
|
+
<label for="node-input-response"><i class="fa fa-refresh"></i> <span >Response</span></label>
|
|
246
|
+
<label for="node-input-response" style="width:70%">
|
|
247
|
+
<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>
|
|
248
|
+
</label>
|
|
249
|
+
</div>
|
|
250
|
+
</script>
|
|
251
|
+
|
|
252
|
+
<script type="text/x-red" data-help-name="Mode">
|
|
253
|
+
<p>Controlling the operating modes of the device, for example, switching between the temperature operating modes of the air conditioner: "Cooling", "Heating" or "Auto".</p>
|
|
254
|
+
|
|
255
|
+
<h3>Property</h3>
|
|
256
|
+
<dl class="message-properties">
|
|
257
|
+
<dt>Device
|
|
258
|
+
<span class="property-type">Select</span>
|
|
259
|
+
</dt>
|
|
260
|
+
<dd> The device to which this feature is connected </dd>
|
|
261
|
+
<dt>Mode Type
|
|
262
|
+
<span class="property-type">Select</span>
|
|
263
|
+
</dt>
|
|
264
|
+
<dd> Selection of the type of modes (cleanup, coffee, input source, work speed, etc.) </dd>
|
|
265
|
+
<dt>Supported commands
|
|
266
|
+
<span class="property-type">List</span>
|
|
267
|
+
</dt>
|
|
268
|
+
<dd> List of commands that are supported by this mode. You can add other commands yourself. </dd>
|
|
269
|
+
<dt>Response
|
|
270
|
+
<span class="property-type">checkbox</span>
|
|
271
|
+
</dt>
|
|
272
|
+
<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.
|
|
273
|
+
If your device takes longer or doesn’t return a confirmation at all, just check this box. </dd>
|
|
274
|
+
</dl>
|
|
275
|
+
</dl>
|
|
276
|
+
|
|
277
|
+
<h3>Inputs</h3>
|
|
278
|
+
<dl class="message-properties">
|
|
279
|
+
<dt>payload
|
|
280
|
+
<span class="property-type">String</span>
|
|
281
|
+
</dt>
|
|
282
|
+
<dd> command from the supported list of commands </dd>
|
|
283
|
+
</dl>
|
|
284
|
+
|
|
285
|
+
<h3>Outputs</h3>
|
|
286
|
+
<dl class="message-properties">
|
|
287
|
+
<dt>payload
|
|
288
|
+
<span class="property-type">Strin</span>
|
|
289
|
+
</dt>
|
|
290
|
+
<dd> command from the supported list of commands </dd>
|
|
291
|
+
</dl>
|
|
292
|
+
<h3>References</h3>
|
|
293
|
+
<ul>
|
|
294
|
+
<li><a href="https://yandex.ru/dev/dialogs/alice/doc/smart-home/concepts/mode-instance-modes-docpage/"> Yandex documentation</a></li>
|
|
295
|
+
</ul>
|
|
296
|
+
</script>
|