SLG / lgtv2mqtt

34 stars 3 forks source link

No MQTT topics visible after install #2

Closed nimroddolev closed 1 year ago

nimroddolev commented 2 years ago

I successfully completed the installation guide and was able to install the tv_service app onto my TV with my MQTT broker settings, as well as add the script to start the service automatically. The app launches on my TV, however, after adding the two MQTT sensors to Home Assistant, they appear as unknown and are never updated.

thestumonkey commented 2 years ago

I have the same, looks like no messages are being published to the MQTT server. Would be great to have some debug logging on the service to see where it's failing.

SLG commented 2 years ago

Have you tried running the service manually? ares-shell -r "luna-send -n 1 -f luna://nl.slg.tv.service/start '{}'" The automatic startup is also failing me sometimes.

But feel free to add any debug information and/or a PR.

thestumonkey commented 2 years ago

would be great to get some more debug information on the console about what it's doing. This may enable us to troubleshoot

On Tue, Aug 9, 2022 at 11:49 AM Stuart Alexander @.***> wrote:

Looks like the service fails to start. After several minutes, I get this message: v-service % ares-shell -r "luna-send -n 1 -f luna://nl.slg.tv.service/start '{}'" { "serviceName": "nl.slg.tv.service", "errorCode": -1, "returnValue": false, "errorText": "nl.slg.tv.service is not running."

On Mon, Aug 8, 2022 at 3:59 PM Sietse Ludger Geertsema < @.***> wrote:

Have you tried running the service manually? ares-shell -r "luna-send -n 1 -f luna://nl.slg.tv.service/start '{}'" The automatic startup is also failing me sometimes.

But feel free to add any debug information and/or a PR.

— Reply to this email directly, view it on GitHub https://github.com/SLG/tv-service/issues/2#issuecomment-1208241253, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKNITJHYPLMUVTDUW6HNTVYEODNANCNFSM55LEBAQQ . You are receiving this because you commented.Message ID: @.***>

nimroddolev commented 2 years ago

When I tried to run the service manually, I received the following error:

{
    "serviceName": "nl.slg.tv.service",
    "errorCode": -1,
    "returnValue": false,
    "errorText": "nl.slg.tv.service is not running."
}
MattL0 commented 2 years ago

same herre

MattL0 commented 2 years ago

luna-send -n 1 -d luna://nl.slg.tv.service/start '{}' {"serviceName":"nl.slg.tv.service","returnValue":false,"errorCode":-1,"errorText":"nl.slg.tv.service is not running."} LUNASERVICE ERROR -1: Could not cancel to unknown client (_LSTransportAddPendingMessageWithToken @ transport.c:4385)

MattL0 commented 2 years ago

/usr/bin/run-js-service -n /media/developer/apps/usr/palm/services/nl.slg.tv.service SERVICE_PATH is /media/developer/apps/usr/palm/services/nl.slg.tv.service

<13>Aug 19 08:50:57 root: [run-js-service] FULL_SERVICE_NAME nl.slg.tv.service Unable to get cgroup: Error: EACCES: permission denied, open '/tmp/run-js-service-no-cgroup' module.js:550 throw err; ^ Error: Cannot find module 'mqtt' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object. (/media/developer/apps/usr/palm/services/nl.slg.tv.service/index.js:3:14) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3)
MattL0 commented 2 years ago

ok got it to work : luna-send -n 1 -f luna://nl.slg.tv.service/start '{}' { "started": true, "returnValue": true }

1- git clone the repo 2- cd into tv-service/tv-service 3- rm package-lock.json 4- npm install

then do the steps written on this repo

mattjacobson6 commented 2 years ago

@MattL0 - not sure if you did something in addition to the above actions (deleting package-lock, running npm install). I'm still having the same issues as the others.

FWIW: running 6.5; confirmed that install did load app & service files to the TV; tried compiling and running from two separate dev machines (with fresh clone of repo).

SLG commented 2 years ago

Hi there! I've updated the app. I created a simple GUI, to get some information about the service: image

You should be able to start and stop the MQTT connection from the app.

Hopefully this gives some insights in your situation.

MattL0 commented 2 years ago

@MattL0 - not sure if you did something in addition to the above actions (deleting package-lock, running npm install). I'm still having the same issues as the others.

FWIW: running 6.5; confirmed that install did load app & service files to the TV; tried compiling and running from two separate dev machines (with fresh clone of repo).

Is your tv rooted?

SLG commented 2 years ago

Not anymore, but I think it doesn't matter. It should work in either case... Rooting allows for some more options, like autostarting, but without root you should still be able to use the app and start the MQTT connection.

mattjacobson6 commented 2 years ago

Yep - TV is rooted, SSH enabled, Homebrew channel installed. I can see the directory structure and confirmed by SSH that the files were installed correctly. I've tried using both the Ares CLI interface and VSCode.

Cloned, changed MQTT creds, packaged, and installed the newest version. I can see and run the new GUI application, but clicking on the buttons doesn't change anything.

My only thought is that maybe there's some conflict with some of the other rooted apps I am running (e.g. PiCap or HyperHDR) which also auto-start.

Really appreciate the work in the original app and the help here!

SLG commented 2 years ago

Do you see anything in the logging? Maybe you could add some more connecting logging, like this:

// Connect to the MQTT broker
const mqttConfig = {
  clientId,
  clean: true,
  connectTimeout: 4000,
  username,
  password,
  reconnectPeriod: 1000,
};
log(`connecting to mqtt server with: ${JSON.stringify(mqttConfig)}`);
client = mqtt.connect(connectUrl, mqttConfig);
mattjacobson6 commented 2 years ago

Added that logging code, but don't think it makes a difference, since I cannot get the service to launch in the first place. Still getting this issue.

ares-shell -r "luna-send -n 1 -f luna://com.slg.tv.service/start '{}'"
{
    "serviceName": "com.slg.tv.service",
    "errorCode": -1,
    "returnValue": false,
    "errorText": "com.slg.tv.service is not running."
}

Might try to stand up an emulator to check things here in a bit.

SLG commented 2 years ago

With the new GUI you do not have to use the console to start the service. You can start it in the GUI. It should provide you with some feedback and logging.

So if you use the GUI to start it, what does the log say? Anything useful?

mattjacobson6 commented 2 years ago

GUI app loads, but clicking the buttons doesn't seem to trigger anything.

https://imgur.com/a/ETSIDrA

SLG commented 2 years ago

Hmm, weird. At least the GUI should load completely... It's missing the State field. What OS (WebOS 6?) do you have? It looks different than mine.

mattjacobson6 commented 2 years ago

I’m on WebOS 6.5…. maybe that’s part of the problem. Rooted, other homebrew apps working.

SLG commented 2 years ago

I've pushed a new version, with (hopefully) more debugging information. Could you give it a try?

thestumonkey commented 2 years ago

I get the same, on screen buttons don't do anything

SLG commented 2 years ago

None of the buttons? I'd hoped that they should at least show some sort of error...

thestumonkey commented 2 years ago

My web is is 6.0.25 btw

On Mon, 5 Sep 2022 at 15:21, Sietse Ludger Geertsema < @.***> wrote:

None of the buttons? I'd hoped that they should at least show some sort of error...

— Reply to this email directly, view it on GitHub https://github.com/SLG/tv-service/issues/2#issuecomment-1237113134, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKNIWFHLIBCBEVKESAMEDV4X6WPANCNFSM55LEBAQQ . You are receiving this because you commented.Message ID: @.***>

SLG commented 2 years ago

Hey @thestumonkey and @mattjacobson6 . I've pushed a new version, with a small fix, that probably fixed the problem. I ran into the same problem (I saw just the buttons on screen) and added the mqtt dependency to the package.json. You should now run npm i before running the ares-package command, and it should work, I think.

thestumonkey commented 2 years ago

Looks like the service fails to start. After several minutes, I get this message: v-service % ares-shell -r "luna-send -n 1 -f luna://nl.slg.tv.service/start '{}'" { "serviceName": "nl.slg.tv.service", "errorCode": -1, "returnValue": false, "errorText": "nl.slg.tv.service is not running."

On Mon, Aug 8, 2022 at 3:59 PM Sietse Ludger Geertsema < @.***> wrote:

Have you tried running the service manually? ares-shell -r "luna-send -n 1 -f luna://nl.slg.tv.service/start '{}'" The automatic startup is also failing me sometimes.

But feel free to add any debug information and/or a PR.

— Reply to this email directly, view it on GitHub https://github.com/SLG/tv-service/issues/2#issuecomment-1208241253, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKNITJHYPLMUVTDUW6HNTVYEODNANCNFSM55LEBAQQ . You are receiving this because you commented.Message ID: @.***>

SLG commented 2 years ago

Ah, that is correct! The id is changed to com.slg.tv.service. nl. was apparantly not recognized by the tv.

thestumonkey commented 2 years ago

Buttons now flash white for a short while, but do nothing. ares-shell -r "luna-send -n 1 -f luna://com.slg.tv.service/start '{}'" { "serviceName": "com.slg.tv.service", "errorCode": -1, "returnValue": false, "errorText": "com.slg.tv.service is not running." }

Still no MQTT topics

YorkshireIoT commented 1 year ago

ok got it to work : luna-send -n 1 -f luna://nl.slg.tv.service/start '{}' { "started": true, "returnValue": true }

1- git clone the repo 2- cd into tv-service/tv-service 3- rm package-lock.json 4- npm install

then do the steps written on this repo

Initially had the same issue described above and these steps worked for me. On non-rooted WebOS 6.3.2. To clarify my steps were:

  1. Install CLI LG WebOS tools as described here: https://webostv.developer.lge.com/develop/tools/cli-installation
  2. Setup developer mode as described here: https://webostv.developer.lge.com/develop/getting-started/developer-mode-app
  3. git clone https://github.com/SLG/tv-service.git
  4. Edit tv-service/index.js updating MQTT server and credential config
  5. cd tv-service/tv-service
  6. If Windows - del package-lock.json, Unix - rm package-lock.json
  7. npm i
  8. ares-package tv-app/ tv-service/
  9. ares-install ./com.slg.tv_0.0.1_all.ipk
  10. Open the app on TV and press start button
  11. Go to another app and start playing, info published into tv-service/playState image
prosenba1 commented 1 year ago

Hi, Were you able to make it work? I have the same result.

SLG commented 1 year ago

Currenty I'm using it almost daily. I've updated the code to be easier to use. I cannot root my tv anymore, so I've tried to find another way to use it.

I've created an automation in Home Assistant where I can start this app when the tv turns on, what works fine.

SLG commented 1 year ago

Hi, Were you able to make it work? I have the same result.

What result do you have?

SLG commented 1 year ago

Owh, and I saw this thread: https://github.com/home-assistant/core/issues/91709 Maybe you can try this, if this isn't working.

prosenba1 commented 1 year ago

{ "serviceName": "com.slg.tv.service", "errorCode": -1, "returnValue": false, "errorText": "com.slg.tv.service is not running." }

{ "serviceName": "com.slg.tv.service", "errorCode": -1, "returnValue": false, "errorText": "com.slg.tv.service is not running." }||

Hi, Were you able to make it work? I have the same result.

What result do you have?

In my case It seems that the service nerver starts. My TV is LG no root, firmware version webos 5.4.3.36 Jhericurl-jebil I get the black screen with the four buttons. After pressing start it takes a couple of minutes an then I get the following message:

"serviceName": "com.slg.tv.service", "errorCode": -1, "returnValue": false, "errorText": "com.slg.tv.service is not running." }

I followed this instructions: https://github.com/SLG/tv-service/issues/2#issuecomment-1399270665 and have no clue what to do next to try to make it work.

Edit: Never mind. Finally it's working! Thank you very much!

SLG commented 1 year ago

What did you do to get it working?

prosenba1 commented 1 year ago

What did you do to get it working?

I had skipped npm i before running the ares-package command. Doing it and rebuilding made the trick.

SLG commented 1 year ago

Check. I've added it to the readme. I think that this fixes the issue for now.