node-red-contrib-alice 2.0.2 → 2.0.4
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/nodes/alice-device.html +9 -0
- package/nodes/alice.html +0 -27
- package/nodes/alice.js +1 -5
- package/package.json +1 -1
package/nodes/alice-device.html
CHANGED
|
@@ -57,6 +57,15 @@
|
|
|
57
57
|
<option value="devices.types.dishwasher">Dishwasher</option>
|
|
58
58
|
<option value="devices.types.iron">Iron, steam generator</option>
|
|
59
59
|
<option value="devices.types.sensor">Sensor</option>
|
|
60
|
+
<option value="devices.types.sensor.motion">Sensor motion</option>
|
|
61
|
+
<option value="devices.types.sensor.vibration">Sensor vibration</option>
|
|
62
|
+
<option value="devices.types.sensor.illumination">Sensor illumination</option>
|
|
63
|
+
<option value="devices.types.sensor.open">Sensor open</option>
|
|
64
|
+
<option value="devices.types.sensor.climate">Sensor climate</option>
|
|
65
|
+
<option value="devices.types.sensor.water_leak">Sensor water_leak</option>
|
|
66
|
+
<option value="devices.types.sensor.button">Sensor button</option>
|
|
67
|
+
<option value="devices.types.sensor.gas">Sensor gas</option>
|
|
68
|
+
<option value="devices.types.sensor.smoke">Sensor smoke</option>
|
|
60
69
|
<option value="devices.types.pet_drinking_fountain">Pet drinking fountain</option>
|
|
61
70
|
<option value="devices.types.pet_feeder">Pet feeder</option>
|
|
62
71
|
<option value="devices.types.other">Other</option>
|
package/nodes/alice.html
CHANGED
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
return this.name || "Alice-Credentials";
|
|
17
17
|
},
|
|
18
18
|
oneditprepare:function(){
|
|
19
|
-
// $('#dev-on-gate').text("checking ...");
|
|
20
19
|
$('#subscribe-status').text("checking ...");
|
|
21
20
|
let em = $('#node-config-input-email').val();
|
|
22
21
|
let idt = $('#node-config-input-id').val();
|
|
23
|
-
getDeviceCount(idt,em,"dev-on-gate");
|
|
24
22
|
getSubscribeStatus(idt,em,"subscribe-status");
|
|
25
23
|
},
|
|
26
24
|
oneditsave: function(){
|
|
@@ -28,31 +26,6 @@
|
|
|
28
26
|
$('#node-config-input-name').val(nodename);
|
|
29
27
|
}
|
|
30
28
|
});
|
|
31
|
-
// function getDeviceCount(id, email, contId){
|
|
32
|
-
// $.ajax({
|
|
33
|
-
// url: "https://nodered-home.ru/api/v1/devices/count",
|
|
34
|
-
// type:"POST",
|
|
35
|
-
// headers: {
|
|
36
|
-
// 'Content-Type':'application/json'
|
|
37
|
-
// },
|
|
38
|
-
// crossDomain: true,
|
|
39
|
-
// contentType:"application/json",
|
|
40
|
-
// data: JSON.stringify({
|
|
41
|
-
// id: id,
|
|
42
|
-
// email: email
|
|
43
|
-
// }),
|
|
44
|
-
// dataType: "json",
|
|
45
|
-
// format:"json"
|
|
46
|
-
// })
|
|
47
|
-
// .done(result=>{
|
|
48
|
-
// $('#'+contId).text(result.data.text);
|
|
49
|
-
// })
|
|
50
|
-
// .fail(error=>{
|
|
51
|
-
// console.log(error)
|
|
52
|
-
// console.error(error.responseJSON);
|
|
53
|
-
// RED.notify("Error : "+error.responseJSON.message, {type:"error"});
|
|
54
|
-
// });
|
|
55
|
-
// };
|
|
56
29
|
function getSubscribeStatus(id, email, contId){
|
|
57
30
|
if (email.length < 3 || id.length < 3){
|
|
58
31
|
return;
|
package/nodes/alice.js
CHANGED
|
@@ -29,7 +29,7 @@ module.exports = function(RED) {
|
|
|
29
29
|
const data = JSON.parse(payload);
|
|
30
30
|
this.trace("Incoming:" + topic);
|
|
31
31
|
if (payload.length && typeof data === 'object'){
|
|
32
|
-
if (arrTopic[
|
|
32
|
+
if (arrTopic[3]=='message'){
|
|
33
33
|
this.warn(data.text);
|
|
34
34
|
}else{
|
|
35
35
|
this.emit(arrTopic[3],data);
|
|
@@ -43,10 +43,6 @@ module.exports = function(RED) {
|
|
|
43
43
|
mqttClient.subscribe("$me/device/commands/+",_=>{
|
|
44
44
|
this.debug("Yandex IOT client subscribed to the command");
|
|
45
45
|
});
|
|
46
|
-
// Подписываемся на получение сообщений
|
|
47
|
-
mqttClient.subscribe("$me/device/message",_=>{
|
|
48
|
-
this.debug("Yandex IOT client subscribed to the message");
|
|
49
|
-
});
|
|
50
46
|
});
|
|
51
47
|
mqttClient.on("offline",()=>{
|
|
52
48
|
this.debug("Yandex IOT client offline. ");
|