LG WebOS better integration

I would like to let Homey:
1/ start the Netflix app on the LG TV.
2/ start the youtube app and cast a youtube link.
but can’t get it to work: When i use the feature ‘start a application’ the list off applications is empty. Any ideas here?

Is the TV turned on when you create your flow?

Does the volume get controlled by the tv-decoder? Does changing the volume via the flow cards work when the TV input is set to the Wii for example?

That did indeed the trick! It can start the applications now. Any idea how to cast a specific youtube video too? :smiley:

Great to hear!

In short, you can’t directly open a video with my app… I know the API probably allows it somehow, however, I have not looked at it so it’s not implemented. Mostly due to the lack of good documentation on how this should work. I know I can send parameters when opening an application, but it’s a bit unclear how it should be formatted.

1 Like

Hi Max,

just created a new Flow ‘Netflix volume’.

But volume will not change

How to select ‘hdmi 3’ for the Change to Wii?

Hi,

Can you show your flow please, its better to help.

Your flow looks just fine, I reckon your TV does not support fully support the used API. Any chance it’s WebOS 5+?

Hey Max.

First of all: thanks for all your hard work, I’m a happy user of your app!

I was looking into opening the WebOS webbrowser to a specific URL (which would be so cool to be able to do).

I know you mentioned that LG TV’s don’t have a consistent API and that you haven’t look into specifying parameters due to lack of documentation, but I was wondering if you had seen this Home Assistent page:

They seem to be able to specify the URL to open (see “Open google command”).

I was wondering whether you have ever experimented with opening a specific URL and what your experiences with it were.

Or even with just making some generic flow card that would allow us to specify a text string for the “app” to open and another text string for the parameter? (such a thing would allow us, users of your app, to experiment with trying various commands and parameters towards a TV, maybe the community could figure out which commands/parameters work for specific tv’s).

Yes it is

changing it with the LG remote works. I do have a sounbar.

i’ll try the simulate button.

Do you know if I can do it via Apple? The device is also listed via Home on my Iphone

So I’ve been playing around a bit and found a few more api calls which might solve some issues for some users. I won’t go into detail as I haven’t researched them much just played around with them.

@Joost_Schevers Related to your message, I managed to open the browser and navigate to a specific url. Works great. I am trying to figure out how to do the same for apps (YouTube, Netflix) but this is just a big mess. I have read the ‘documentation’ but nothing seems to work. The app opens perfectly fine but it won’t navigate to any content.

I can create a text field where users could supply the parameters to find things out themselves but I am unsure if anyone actually will :wink:. The app mostly relies on ConnectSDK which is pretty old by now and hardly updated.

I will most like soon add the browser option and some other cards to support better app/input integration

I have some issues with the “state of the device”. Homey can’t identify when my television is on or off. Sometimes I’m watching a movie and Homey thinks that the television is off. I’ve found the advanced settings, but I don’t know what settings I need to update/change. Some suggestions/tips are more than welcome!

Homey version: 4.2.0
WebOS Plus: 2.2.1
Television: Oled55C8
Software television: 05.30.02

Hi @SejoerdO,

Can you share your current advanced settings? That way it is easier to give advice.

Hereby a screenshot @MaxvandeLaar

I hat to set “Use polling…” Yes for my setup.

1 Like

I will try this and keep you updated.

in my tests i needed polling for tvs on wifi and non polling voor cabled tvs. i have a 2018 and two 2020 models. the 2018 one worked without polling till it moved to a place using wifi.

1 Like

@SejoerdO,

So after I explained how this works to someone else before I noticed I choose horrible labels as it can get a bit confusing; sorry for that :wink:

So how it works… (the dumbed down explanation)

The TV sends messages to my app when it powers off. However, what kind of messages and the order they are send differ almost per TV and software version. It is a bit chaotic.

This can be controlled by the Timeout power off check. By setting it to 10000 it will tell the app to wait 10 seconds after it received an ‘Off’ notification from the TV to set it to off in the app. This is due to the strange order of the notifications. For example, I sometimes receive an TV is off notification and after that a TV is going in suspended mode… while the actual order is suspended (but the status of the tv is still active) and then it turns off. The code for that looks like this:

      timer = setTimeout(() => {
        this.log(`_powerStateListener: Called timeout`, status, processing);

        //Screen saver(?) should tv be turned on?
        if (((status === 'active' || status === 'screen saver' || status === 'screen off') && !processing) ||
          (processing &&
            (
              processing.includes('on') ||
              processing.includes('ready') ||
              processing.includes('resume') ||
              processing.includes('saver')
            )
          )
        ) {
          handleOn();
        } else if ((!processing && status !== 'active' && status !== 'screen off') ||
          (processing && (
              processing.includes('standby') ||
              processing.includes('suspend') ||
              processing.includes('off')
            )
          )
        ) {
          handleOff();
        }

        clearTimeout(timer);
        timer = null;
      }, this.getSettings().powerStateTimeout || 2000);

Some TV’s actually never send these notifications or only partially. Therefore, I also implemented the possibility to use a simple network polling method.

If the Power off check is not working for you (which it isn’t in this case) you can set Use polling... to Yes.

Now the other to params come into play.

The Poll interval on/off check is simply the interval the app will poll. So in the default case it will check if the TV is on/off every 10 seconds and it will give the TV 8 seconds (Poll timeout on/off check) to tell it’s alive, else it’s dead so it’s turned off. The Poll timeout should never be higher than the Poll interval. You can play with these two parameters to find the perfect settings for you. It might be possible that due to a slow network or just slow TV the TV needs more than 8 seconds to respond to a poll. So I would suggest to start with a poll interval of 30 seconds and give the TV 20 seconds to reply. If that works, just try to lower the values until you find the sweet spot.

I hope this explanation helps everyone. If not, feel free to ask :slight_smile:

4 Likes