From 3e3a75cdd3ac94197d5e55dee68e6d5187754396 Mon Sep 17 00:00:00 2001 From: Mohammed Al Zubaidi Date: Tue, 29 Nov 2022 22:20:53 +0400 Subject: [PATCH] Update lgtv-mute.js --- nodes/lgtv-mute.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/nodes/lgtv-mute.js b/nodes/lgtv-mute.js index 594f7a1..837e5a5 100644 --- a/nodes/lgtv-mute.js +++ b/nodes/lgtv-mute.js @@ -15,15 +15,29 @@ module.exports = function (RED) { if (node._wireCount) { node.tvConn.subscribe(node.id, 'ssap://audio/getVolume', (err, res) => { - if (!err && res && res && res.changed.indexOf('muted') !== -1) { - node.send({payload: res.muted}); +// if (!err && res && res && res.changed.indexOf('muted') !== -1) { +// node.send({payload: res.muted}); +// } + if (!err && res) { + if (res.muted !== undefined){ + node.send({payload: res.muted}); + } + if (res.volumeStatus !== undefined){ + node.send({payload: res.volumeStatus.muteStatus}); + } } }); node.tvConn.on('tvconnect', () => { node.tvConn.request('ssap://audio/getVolume', (err, res) => { if (!err && res) { - node.send({payload: res.muted}); +// node.send({payload: res.muted}); + if (res.muted !== undefined){ + node.send({payload: res.muted}); + } + if (res.volumeStatus !== undefined){ + node.send({payload: res.volumeStatus.muteStatus}); + } } }); });