hobbyquaker / node-red-contrib-lgtv

Node-RED Nodes to control LG webOS Smart TVs :tv:
http://flows.nodered.org/node/node-red-contrib-lgtv
MIT License
59 stars 21 forks source link

Volume and Mute nodes issue WebOS 2021 #51

Open mreyad opened 1 year ago

mreyad commented 1 year ago

I was using this node for some years with my 8 years old LG TV, recently I bough new LG TV 2021 (NANO86) which seems using newer version of WebOS.

In the last couple of days I was trying to find the API documentation that you used to build your node, unfortunatly I could not find it. The reason that I started to get errors after deploying the "Volume" or "Mute" nodes and connect them to the new TV, after invertigation I found that the array objects in the old WebOS are different than the new one.

In LG website where they have listed the references for thei WebOS API, the response for "getVolume" array is as follows:

{"returnValue":true,"volumeStatus":{"activeStatus":true,"adjustVolume":true,"maxVolume":100,"muteStatus":true,"volume":12,"mode":"normal","soundOutput":"tv_external_speaker"},"callerId":"com.webos.service.apiadapter","mute":true,"volume":12}

comparing to the array that used in the old WebOS: {"returnValue":true,"scenario":"mastervolume_tv_speaker","volume":98,"mute":false}

I did a small change on the volume.js and mute.js as follows:

volume.js

Line 19: if (!err && res) {

Line 20:

// node.send({payload: res.volume});
if (res.volume !== undefined){
    node.send({payload: res.volume});
}
if (res.volumeStatus !== undefined){
    node.send({payload: res.volumeStatus.volume});
}

Line 27:

// node.send({payload: res.volume});
if (res.volume !== undefined){
    node.send({payload: res.volume});
}
if (res.volumeStatus !== undefined){
    node.send({payload: res.volumeStatus.volume});
}

similar changes I made to mute.js.

Are you willing to do these changes on the node and publish it, to that it will be compatible with the old WebOS and the new one.