bentemple / nvidia_shield_tv_controller

This project creates discrete application icons to launch from the Nvidia Shield TV homescreen that can change your TV's input selection.
GNU General Public License v3.0
20 stars 3 forks source link

New LG TV's have keycode in IP Control #2

Closed rbcetin closed 1 month ago

rbcetin commented 4 years ago

Telnet closes itself after connection, probably because the new keycode thing.

There is another project https://github.com/WesSouza/lgtv-ip-control,

can we implement this logic into this project?

bentemple commented 3 years ago

@rbcetin you willing to help me test some stuff? I don't have an LG tv, so hard for me to verify if something is working.

rbcetin commented 3 years ago

Yep I can help you

sorryusernameisalreadytaken commented 3 years ago

@rbcetin you willing to help me test some stuff? I don't have an LG tv, so hard for me to verify if something is working. I guess the time for the LG integration was a bit short. Unfortunately, I can not establish a telnet connection, but find the project ingenious.

I have specially fetched the new ShiledTV remote 2019 (the one with the Netflix button) and only then discovered this git here. This allows me to define the menu button. One option of the Shield for this is to switch through the HDMI channels. I don't understand why nvidia can't have more IR codes trained. VOL+- works fine on my Onkyo even when the Shield is off.

Nice work @bentemple

I would be happy to contribute my knowledge here but am now not so the Android code professional :D Is this the last change to this topic? https://github.com/bentemple/nvidia_shield_tv_controller/commit/fe63899d9097188f0fef029f1abb91edb2cf3ebb

If I hadn't found this git here, I probably would have tried this and then addressed my HomeAssistant (HTTP POST/GET) and run individual commands on the TV: https://f-droid.org/en/packages/io.github.sds100.keymapper/

The connection between HomeAssistant and LG is working fine: https://www.home-assistant.io/integrations/webostv/ https://www.youtube.com/watch?v=LFr7JrVYe-A

bentemple commented 3 years ago

Yeah, I haven't done any more. seems like it would almost be more universal to forward commands from the shield to homeassistant, and let home assistant control the TV? obviously my setup doesn't support the latest LG tvs and I haven't gotten around to fixing it, but home assistant is pretty universal, so if we just invoke home assistant commands from "tiles" on the nvidia shield UI that would probably be quite easy to get working and pretty useful...

bentemple commented 1 month ago

OK, so I was able to use the same integration with my home assistant setup. So I'll be creating a configuration / updating the code in the coming days or weeks to connect to home assistant.

I'm sure you've moved on from this, but if you're still interested, the update is coming :)

HA is far more universal, so I figure by supporting it, people can leverage this to control a lot more things much more easily.

Then you can just add an event driven automation and do whatever you want in HA.

Here's what my automation basically looks like:

 id: '1721312106762'
  alias: Nvidia Shield Input Source Controller
  description: ''
  trigger:
  - platform: event
    event_type: nvidia_shield_tv_request
    event_data: {}
  condition: []
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.command == "playstation" }}'
      sequence:
      - service: media_player.select_source
        target:
          device_id: 82320ac14909b682c69011be87520f89
        data:
          source: Playstation 4
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.command == "shield" }}'
      sequence:
      - service: media_player.select_source
        target:
          device_id: 82320ac14909b682c69011be87520f89
        data:
          source: Nvidia Shield
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.command == "nintendo_switch" }}'
      sequence:
      - service: media_player.select_source
        target:
          device_id: 82320ac14909b682c69011be87520f89
        data:
          source: Nintendo Switch
  mode: single

Note: I have renamed my HDMI inputs to Nintendo Switch. If you haven't done that, it'll probably just be HDMI-1 or something.

sorryusernameisalreadytaken commented 1 month ago

OK, so I was able to use the same integration with my home assistant setup. So I'll be creating a configuration / updating the code in the coming days or weeks to connect to home assistant.

I'm sure you've moved on from this, but if you're still interested, the update is coming :)

HA is far more universal, so I figure by supporting it, people can leverage this to control a lot more things much more easily.

Then you can just add an event driven automation and do whatever you want in HA.

Here's what my automation basically looks like:

 id: '1721312106762'
  alias: Nvidia Shield Input Source Controller
  description: ''
  trigger:
  - platform: event
    event_type: nvidia_shield_tv_request
    event_data: {}
  condition: []
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.command == "playstation" }}'
      sequence:
      - service: media_player.select_source
        target:
          device_id: 82320ac14909b682c69011be87520f89
        data:
          source: Playstation 4
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.command == "shield" }}'
      sequence:
      - service: media_player.select_source
        target:
          device_id: 82320ac14909b682c69011be87520f89
        data:
          source: Nvidia Shield
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.command == "nintendo_switch" }}'
      sequence:
      - service: media_player.select_source
        target:
          device_id: 82320ac14909b682c69011be87520f89
        data:
          source: Nintendo Switch
  mode: single

Note: I have renamed my HDMI inputs to Nintendo Switch. If you haven't done that, it'll probably just be HDMI-1 or something.

This is amazing!

That will perhaps let me create Netflix icons to open the LG-Netflix app from any android TV.

bentemple commented 1 month ago

Yay :) I'll get you more info, and an updated readme + the code changes and everything hopefully this weekend

It's super easy since ultimately just a curl request

bentemple commented 1 month ago

I have added support for home assistant. With the HA LG WebOS TV integration, you should now be able to set this up to control your TV. see HomeAssistantSetup.md for more details.

Feel free to reopen this issue or open a new issue if you run into any issues with the setup. Eventually I plan to add the ability to configure the app with an on-device file, so you don't have to setup Android Studio and your build environment just to install the basic apps and use them as they're setup now.