home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.51k stars 30.71k forks source link

Webostv.button service Not working properly #46446

Closed haffisi closed 3 years ago

haffisi commented 3 years ago

The problem

I have a wierd issue regarding webostv.button service I have to touch (lift) Magic remote control to be able to send some button commands Only button comands that work without lifting/shaking are Volume upp/down, turn on/off and mute. I have IPTV setup box connected to HDMI input and configured as Universal remote. I get notification on the LG TV saying Please control with magic remote. If i just lift the remote up and then send the command from home assistant t will work.

What is version of Home Assistant Core has the issue?

System Health version | core-2021.2.3 -- |

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

webostv

Link to integration documentation on our website

https://www.home-assistant.io/integrations/webostv/

Example YAML snippet

# Put your YAML below this line

Anything in the logs that might be useful for us?

# Put your logs below this line

image

https://user-images.githubusercontent.com/77636421/107766307-2a8f7c80-6d2b-11eb-8f41-d8be4f64ac85.mp4

probot-home-assistant[bot] commented 3 years ago

Hey there @bendavid, mind taking a look at this issue as its been labeled with an integration (webostv) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

bendavid commented 3 years ago

This sounds like a limitation of the TV/webos rather than home assistant. Not sure there's anything which can be done from this side.

You could try replacing "button" with "command" (in that case the corresponding command would be TV_CHANNEL_UP)

haffisi commented 3 years ago

Hi thanks for the answer it look like that doesn't work either. Do you know where i could report that issue. I'm just wondering if some command need to be fired to handshake the tv remote before triggering button commands.

bendavid commented 3 years ago

Hi, LG is not very responsive about this sort of thing, and probably consider any use of the websockets API outside of "official" apps as unsupported.

You could try posting on https://lgcommunity.us.com/categories/oled-tvs, but I'd be pretty surprised if you got anything approaching a useful response.

haffisi commented 3 years ago

You were right - i'm not getting any answer except some people having similar problems.

I'm wondering is this possible with home assistant com.webos.service.networkinput/getPointerInputSocket and then send commands with payload? I find it so weird that i can do this commands if i pick up the remote first but ofcourse it's not working with automations/scripts unless i rent some dude to shake my remote :D

_

I am probably a bit late to the game but for anyone else who is in the same pickle. Sending buttons isn't that difficult, however, still took me some time to find enough information about this.

So here is short example:

lgtv.getSocket('ssap://com.webos.service.networkinput/getPointerInputSocket', function (err, sock) { if (!err) { sock.send('button', {name: 'LEFT'}); // ok = ENTER } }); I have not yet found a list with all possible buttons but it's pretty straight forward, I did found more buttons here https://github.com/supersaiyanmode/PyWebOSTV/blob/master/pywebostv/controls.py

_

bendavid commented 3 years ago

The input socket is already used by the client library, and the pointer functions can be accessed through the move, click, and scroll functions in the client library https://github.com/bendavid/aiopylgtv/blob/3f610fec85904ba95e3b74fbe7f32ae8f2ceacce/aiopylgtv/webos_client.py#L733-L750

This would need some small additions to home assistant to be usable though.

Also worth understanding whether one of the official LG apps works as expected (then we could try and figure out what commands it's sending)

What TV model do you have btw? (Something with WebOS 5.x I guess?)

haffisi commented 3 years ago

I have LG-OLED 65CX6LA WebOS 5.2 Firmware - 03.21.16 I tried the official LG ThinQ app but it’s the same issue there i need to touch the remote first to send the commands to the connected IPTV setup box. Therefore I feel like this is a BUG/feature related to the TV firmware rather than Home Assistant.. To bad I can’t expose IPTV box straight to HA (it’s locked on ISP VLAN). Probably I need to buy some kind of IR blaster so i can splice some scripts/automation/buttons together?

bendavid commented 3 years ago

Can you explain a bit better what you're trying to do? You're trying to send commands to the IPTV box via HDMI CEC from the TV?

Does the same problem with buttons not working until the remote is picked up also occur when trying to simply control the TV, or does this only occur when trying to forward commands to the IPTV box over CEC?

haffisi commented 3 years ago

First of all thanks for trying to help me out and I’m sorry for not being clear enough.

You're trying to send commands to the IPTV box via HDMI CEC from the TV?

True

Does the same problem with buttons not working until the remote is picked up also occur when trying to simply control the TV, or does this only occur when trying to forward commands to the IPTV box over CEC?

I was testing this now. And buttons are working fine through for example Netflix app. Therefore this only occur when forwarding commands to the IPTV box over CEC

bendavid commented 3 years ago

Ok something else you could try is a pc with a usb CEC adapter (e.g. a raspberry pi or similar) or something like a HardKernel Odroid N2 running CoreElec+kodi which could be used to send CEC commands independent of the TV. Not sure exactly if/how this would work though, so probably an IR blaster is simpler.

haffisi commented 3 years ago

Interesting! Do you know if i could use this Addon - CEC-SCAN? I have HA OS installed on raspberry pi 4 - Does it have to be usb to CEC adapter or could i connect the same Raspberry PI (with HA OS installed) from HDMI output on the Pi to HDMI input on the TV?

haffisi commented 3 years ago

Sorry i think i found the answer :) Thanks

CEC Setup ADAPTER The computer running Home Assistant must support CEC, and of course be connected via HDMI to a device also supporting CEC. You can purchase a USB CEC adapter to add support if necessary. Note that all Raspberry Pi models support CEC natively.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.