madmicio / LG-WebOS-Remote-Control

Remote Control for LG TV WebOS
393 stars 74 forks source link

Custom volume control device #85

Open Xinne opened 2 years ago

Xinne commented 2 years ago

Hi all,

I experienced some problems while trying to change the volume of my soundbar (sonos playbar with optical cable to the TV). When configured correctly the playbar does change volume when using the physical remote, but i discovered that this behaviour is achieved by a little hack: when changing the volume the tv sends a command (RF) to the remote, and the remote transmits the IR command to the sonos bar.

This causes two problems. The first one is pretty clear: when changing the volume from the web remote control card while the physical remote is hiding in the couch or god knows where, the IR-command never reaches the sonos bar. Secondly a situation can arise where the TV 'thinks' it is muted whilst the sonos is unmuted. Since the TV does not stop outputting sound to the optical output when muted, this causes a mute icon when the sonos is unmuted and visa versa.

This pull request adds the possibility to add a custom media_player to control when a certain sound mode is selected or the device if off (control soundbar playing music when the tv is off).

Check the readme for details! Im planning to write a option to also control the host so the mute icon is displayed when the host is muted, but since the host sometimes unmutes the output device (when the remote is pointed at the soundbar) and the tv does not specify mute on/off but just toggles it this was a little more work then expected.

shadsnz commented 1 year ago

Hi Xinne,

How can I try your change? I've downloaded the lg-remote-control.js file and replaced the existing one in my HA (/www/community/www/community/LG-WebOS-Remote-Control). Is this correct approach?

I've then configured the front end card:

type: custom:lg-remote-control entity: media_player.lg_webos_tv_oled65c9pva mac: .... sources:

However, on clicking the mute button the TV itself responds.

Many thanks for your work on this change. The functionality will be a great addition.