node-red-contrib-yandex-station-management 0.3.1 → 0.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/nodes/get.js +25 -20
- package/nodes/yandex-login.js +1 -1
- package/package.json +1 -1
package/nodes/get.js
CHANGED
|
@@ -21,27 +21,32 @@ module.exports = function(RED) {
|
|
|
21
21
|
if (node.output == 'status') {
|
|
22
22
|
inputMsg.payload = message;
|
|
23
23
|
} else if (node.output == 'homekit') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ConfiguredName
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
try {
|
|
25
|
+
if (node.homekitFormat == 'speaker') {
|
|
26
|
+
let ConfiguredName = `${(message.playerState.subtitle) ? message.playerState.subtitle : 'No Artist'} - ${(message.playerState.title) ? message.playerState.title : 'No Track Name'}`;
|
|
27
|
+
let title = `${message.playerState.title}`;
|
|
28
|
+
if (ConfiguredName.length > 64 && title.length > 0 && title.length <= 64) {
|
|
29
|
+
ConfiguredName = title;
|
|
30
|
+
} else {
|
|
31
|
+
ConfiguredName = title.substr(0, 61) + `...`;
|
|
32
|
+
}
|
|
33
|
+
(message.playerState)? inputMsg.payload = {
|
|
34
|
+
"CurrentMediaState": (message.playing) ? 0 : 1,
|
|
35
|
+
"ConfiguredName": ConfiguredName
|
|
36
|
+
} :inputMsg.payload = {
|
|
37
|
+
"CurrentMediaState": (message.playing) ? 0 : 1,
|
|
38
|
+
"ConfiguredName": `No Artist - No Track Name`
|
|
39
|
+
}
|
|
40
|
+
}else if (node.homekitFormat == 'tv') {
|
|
41
|
+
inputMsg.payload = {
|
|
42
|
+
"Active": (message.playing) ? 1 : 0
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
debugMessage(`Error while preparing payload: `+ e);
|
|
44
48
|
}
|
|
49
|
+
|
|
45
50
|
}
|
|
46
51
|
return inputMsg;
|
|
47
52
|
|
package/nodes/yandex-login.js
CHANGED
|
@@ -323,7 +323,7 @@ module.exports = function(RED) {
|
|
|
323
323
|
//device.ws.on('ping', function);
|
|
324
324
|
device.ws.on('close', function close(code, reason){
|
|
325
325
|
statusUpdate({"color": "red", "text": "disconnected"}, device);
|
|
326
|
-
debugMessage(`readyState: ${device.ws.readyState}`)
|
|
326
|
+
//debugMessage(`readyState: ${device.ws.readyState}`)
|
|
327
327
|
device.lastState = {};
|
|
328
328
|
clearTimeout(device.watchDog);
|
|
329
329
|
switch(code) {
|