SLG / lgtv2mqtt

34 stars 3 forks source link

LG C9 MQTT communication #4

Open markmghali opened 1 year ago

markmghali commented 1 year ago

Hello,

I am trying to get this setup on my rooted TV. I am not understanding steps 2 and 3 to enable ares-cli. Is this via putty on a computer to the TV? Is there an app I can install from the homebrew store to set this all up?

Thank you

markmghali commented 1 year ago

I am able to ssh to the TV. But trying to figure what where or what to do with these steps is confusing. Any assistance would be helpful?

markmghali commented 1 year ago

ok I got it installed using a Linux machine instead of windows. and I created the sensors in home assistant but I am not seeing the sensors output anything in home Assistant

markmghali commented 1 year ago

Okay I have the application installed but I cannot tell if it is starting when I press start. I have hyperhdr on the TV already and I see it in my mqtt broker but not this application.

Thank you for the work on this !

SLG commented 11 months ago

Hey! Sorry for my late response! You should be able to install the app by following the steps as described in the readme. When installed there should be an app on your tv's homescreen, that should show the state of the service.

markmghali commented 11 months ago

Thank you for the reply. I did get it complied and installed but nothing happens when I try and start the service on the TV.

This app could be incredibly useful! Thank you for all the work! I really want to get my play pause state from my TV.

My TV is rooted You could also add this app to the homebrew-channel to make adoption even easier. I guess you would need to be able to configure it within the app itself first.

https://github.com/webosbrew/webos-homebrew-channel

markmghali commented 11 months ago

so got the new version installed but nothing happens no logs nothing when I press start on the TV APP.

I also could not find what file to change these values in:

const host = 'YOUR MQTT BROKER HOST'; const port = '1883'; // OR THE POR OF THE BROKER const username = 'YOUR MQTT USERNAME'; const password = 'YOUR MQTT PASSWORD';

EDIT: nevermind found it in index.js in the tv-service folder

markmghali commented 11 months ago

formatted const host = 'mqtt://YOUR MQTT BROKER HOST';

is that correct to have the mqtt:// then IP Address?

still not getting it to work.

I am using mqtt from the tv already for hyperhdr I am assuming that is not a conflict? I can see it connecting o my mqtt broker host for hyperhdr.

Sorry for all the questions. I just really want to get this working

markmghali commented 11 months ago

@szymon3 did you get yours working?

I am trying to run as root and not in dev mode?

after installing on my tv the service is failing to start

SLG commented 11 months ago

Hmm, you see nothing happening on the screen? No logs, no errors, no state?

In the latest version, you should update the config to something like this:

const config: LgTvMqttConfig = { host: '192.168.1.XX', port: 1883, username: 'A_USERNAME', password: 'A_PASSWORD', deviceID: 'webOSTVService' };

Where host should be the host of your MQTT broker, and username/password as you've setup in the broker.

But before that should be logged that it's trying to connect...

markmghali commented 11 months ago

Yeah I don't see that it's trying to connect. I push start and nothing happens no logs or anything.

Let me check the code on the file later today. I believe I tried that.

markmghali commented 11 months ago

So this in the index.js file in the tv-service folder. do I add it anywhere else?

image

Also here is a video of running the app on my TV

https://youtube.com/watch?v=Ensney8Lzgo&si=NUZwp7N_wfblQ0bE

SLG commented 11 months ago

No, that should be the place.

I've pushed some updates. Can you try it with the latest version?

markmghali commented 11 months ago

yes let me try

markmghali commented 11 months ago

silly question leave the single quotes there correct?

like this:

image

SLG commented 11 months ago

Yes!

markmghali commented 11 months ago

not fully understanding these steps?

Update package-and-install.bat with the id of your tv, if needed

I did not change the deviceID in index.ts so I would not need to do above step correct?

Run package-and-install.bat

Are you meaning run in a terminal like ./package-and-install.bat?

instead of the ares-install ./com.slg.lgtv2mqttxxxxxxxxx command

SLG commented 11 months ago

Yes! I've updated the code to Typescript, so that requires a few additional steps. I've automated that in the bat file. If you're on Linux, you cannot use the .bat, and should have a .sh.

markmghali commented 11 months ago

I am on a linux VM yeah. do I just change the extension from .bat to ,sh?

I did try that and it didn't work

image

I also am trying the instructions from beginning and not sure where to run the npm install command? tried running it and getting an error it cannot find the package.json file

SLG commented 11 months ago

I've added a .sh file that you should be able to run. It shouldn;t be necessary to run the npm instal command yourself enymore.

markmghali commented 11 months ago

ok so I want to properties on the .sh file and enabled executable as program image

than I ran it and got the ipk file. it did not push it to the TV

I than ran this and it installed it

image

trying it now on the TV

markmghali commented 11 months ago

I like the new icon! however same behavior it didn't work. I am guessing it is some lack of knowledge on my end maybe?

markmghali commented 11 months ago

here is the output of running the .sh file

image

then it still creates the .ipk after that

SLG commented 11 months ago

Hmm, those errors are not what you expect. I've updated the script a little. Can you give it another try?

markmghali commented 11 months ago

Yes, I'll try again! Really appreciate you walking me through all this!

On Thu, Nov 30, 2023, 1:21 PM Sietse Ludger Geertsema < @.***> wrote:

Hmm, those errors are not what you expect. I've updated the script a little. Can you give it another try?

— Reply to this email directly, view it on GitHub https://github.com/SLG/lgtv2mqtt/issues/4#issuecomment-1834409239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEENN4GYFWZQIA2FHDDK56DYHDMEHAVCNFSM6AAAAAAUX5RN36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZUGQYDSMRTHE . You are receiving this because you authored the thread.Message ID: @.***>

markmghali commented 11 months ago

Ok so the compile looks better image

image

the install failed so I pushed it manually and that worked see above screenshot.

Also the ipk size looks better about 8mb before it was much smaller. waiting to test it on the TV in a moment.

markmghali commented 11 months ago

well darn it is still not doing anything when I press start on the TV. not sure where to go from here. LG C9 is not on webos6 just FYI but figured it would work.

Mincka commented 6 months ago

Hi,

Also tried on C9 and here I am with the same results. Nothing happens when clicking on buttons. I tried to use webOS TV 6.0 Simulator and, strangely, I get the same behavior.

I can debug the App with the inspector, but I don't know how to debug the service. When I call the functions in the console, nothing happens. I only get an error when the name of the package is invalid, so I know it's loaded at least.

I wanted to see if some errors could be fixed to make it work on webOS 4.x, but if cannot even make it work on the 6.0 Simulator, I don't think I'll manage to do that.

@SLG How did you debug the service during its development?

markmghali commented 6 months ago

Yes I would love to get this working on my C9! Let me know how I can help!

On Sat, Apr 20, 2024, 12:27 PM Julien Ehrhart @.***> wrote:

Hi,

Also tried on C9 and here I am with the same results. Nothing happens when clicking on buttons. I tried to use webOS TV 6.0 Simulator and, strangely, I get the same behavior.

I can debug the App with the inspector, but I don't know how to debug the service. When I call the functions in the console, nothing happens. I only get an error when the name of the package is invalid, so I know it's loaded at least.

I wanted to see if some errors could be fixed to make it work on webOS 4.x, but if cannot even make it work on the 6.0 Simulator, I don't think I'll manage to do that.

@SLG https://github.com/SLG How did you debug the service during its development?

— Reply to this email directly, view it on GitHub https://github.com/SLG/lgtv2mqtt/issues/4#issuecomment-2067736133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEENN4ASBFQ2UTM7SB6FFZ3Y6KQRPAVCNFSM6AAAAAAUX5RN36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXG4ZTMMJTGM . You are receiving this because you authored the thread.Message ID: @.***>

SLG commented 6 months ago

Did you try the latest version? I'm on a C1, so it's a lot older than the C9...

I didn't really debug, I added a lot of logging on screen, to see what's going on.

Annoying that even the simulator is not working! What is the exact error? Maybe they have enforced some specific format for the package name/path?

Mincka commented 6 months ago

Sadly, that's not the case, C9 is older. C9 is from 2019 and it's running WebOS 4.9 as the latest version. C1 is from 2021 and it's running WebOS 6.0. C9 and C1 are reference to the last digit of the year.

The oldest version of the "Simulator" is for webOS TV 6.0.

Before that, LG only provided an "Emulator", which is a VM + Java app for the remote.

I just managed to run it with the remote, but I still don't know how to debug the service part of an application, maybe with one of the ares commands, like ares-log if it was already there in this version. image

SLG commented 6 months ago

Ah, I thought that the C9 would be newer! I've just tried with the Emulator too, but indeed, it does not work. And I think I know the problem: https://webostv.developer.lge.com/develop/guides/js-service-basics#supported-nodejs-version The current service is based on a newer Node version. I could have a look to see if I can add support for this older version.

SLG commented 6 months ago

To add least get the app on the Emulator, you should do this:

So somehow the service is not starting. I'm not really sure how to debug this. Maybe we can access the logs somehow.

Mincka commented 6 months ago

Thank you for trying to make it work on earlier version.

The only command I know is ares-log, but I don't manage to see the logs related to the service.