node-red-contrib-alice 2.0.1 → 2.0.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/nodes/alice-device.html +9 -0
- package/nodes/alice.html +35 -28
- 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,7 +16,7 @@
|
|
|
16
16
|
return this.name || "Alice-Credentials";
|
|
17
17
|
},
|
|
18
18
|
oneditprepare:function(){
|
|
19
|
-
$('#dev-on-gate').text("checking ...");
|
|
19
|
+
// $('#dev-on-gate').text("checking ...");
|
|
20
20
|
$('#subscribe-status').text("checking ...");
|
|
21
21
|
let em = $('#node-config-input-email').val();
|
|
22
22
|
let idt = $('#node-config-input-id').val();
|
|
@@ -28,32 +28,35 @@
|
|
|
28
28
|
$('#node-config-input-name').val(nodename);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
function getDeviceCount(id, email, contId){
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
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
56
|
function getSubscribeStatus(id, email, contId){
|
|
57
|
+
if (email.length < 3 || id.length < 3){
|
|
58
|
+
return;
|
|
59
|
+
};
|
|
57
60
|
$.ajax({
|
|
58
61
|
url: "https://nodered-home.ru/payment/getsubscribestatus",
|
|
59
62
|
type:"POST",
|
|
@@ -221,13 +224,17 @@
|
|
|
221
224
|
<p><b>Subscription:</b></p>
|
|
222
225
|
</div>
|
|
223
226
|
<div class="form-row">
|
|
224
|
-
<label for="node-config-input-token" style="width: 150px">
|
|
225
|
-
<label for="node-config-input-token" style="width: 150px">Subscription status:</label> <span id="subscribe-status"></span>
|
|
227
|
+
<label for="node-config-input-token" style="width: 150px">Subscription status:</label> <span id="subscribe-status"></span>
|
|
226
228
|
<div class="form-tips" id="node-tip-subscribe-warn">
|
|
227
229
|
<span>Important:</span><br>
|
|
228
230
|
<span> - By purchasing a subscription, you agree to the terms of the <a href="https://nodered-home.ru/public_offer.pdf" target="_blank">public offer</a></span><br>
|
|
229
231
|
<span> - View and manage your subscriptions <a href="https://my.cloudpayments.ru/ru/unsubscribe" target="_blank">here</a></span>
|
|
230
232
|
<div style="text-align: end">
|
|
233
|
+
<!-- <label for="node-input-subList" style="text-align: start">Period:</label>
|
|
234
|
+
<select id="node-input-subList" style="width:70%; margin-top:10px; margin-bottom:10px;">
|
|
235
|
+
<option value=1>1 month - 199 rubles</option>
|
|
236
|
+
<option value=12>12 month - 2 300 rubles</option>
|
|
237
|
+
</select> -->
|
|
231
238
|
<button id="subscribe-button"
|
|
232
239
|
onclick="pay($('#node-config-input-id').val(), $('#node-config-input-email').val())"
|
|
233
240
|
class="ui-button">Buy a subscription
|
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. ");
|