TBSniller / piccap

PicCap - Hyperion Sender App | Ambilight for LG WebOS TVs
MIT License
307 stars 33 forks source link

Piccap autstart does not work #25

Closed denimjeans closed 2 years ago

denimjeans commented 2 years ago

Hi, first of all: thanks everyone who contributed to this project. :-)

I have an issues with autostart on my TV:

    "board_type": "O18_DVB",
    "hardware_id": "HE_DTV_W18O_AFABABAA",
    "product_id": "OLED65C8LLA",
    "core_os_release": "4.4.0-9",
    "webos_manufacturing_version": "05.40.09",

using piccap version 2.3

When I turn on the TV, background lit up, but stays on white color. I need to go into Piccap and stop & start service to have connection to the hyperion server. then it works fine. Any Idea why it does not work automatically?

gomble commented 2 years ago

I have exactly the same problem

Informatic commented 2 years ago

I assume both of you are using libdile_vt?

Have you used some older piccap version? If so, then please try running rm /var/lib/webosbrew/init.d/piccapautostart, then go to piccap settings, disable autostart, save, reenable autostart, save... I think we still have a minor bug in autostart handling which fails when some old piccap version (before 0.2.x) was installed before and left some files on the filesystem.

gomble commented 2 years ago

I assume both of you are using libdile_vt?

Have you used some older piccap version? If so, then please try running rm /var/lib/webosbrew/init.d/piccapautostart, then go to piccap settings, disable autostart, save, reenable autostart, save... I think we still have a minor bug in autostart handling which fails when some old piccap version (before 0.2.x) was installed before and left some files on the filesystem.

yes i had 2 older versions of picap on my lg. I will test this and come backk

denimjeans commented 2 years ago

did that, but for me it seems not to fix the issue. Autostart seems to working, but not connecting to the hyperion server. via manual start it works. how can i deinstall completely and install again?

it looks like it does not load a config, only when manual restart then it does... at least this describes my issue

TBSniller commented 2 years ago

Do you guys have some more information for us? Which settings are you using?

wehrstedt commented 2 years ago

I investigated a workaround to autostart the capture service without rebooting the tv or disabling the quick start. I used home assistant to turn off and on the capture service once the tv turned on. If someone is interested in it .. Don't know if this is the right place for this.

gomble commented 2 years ago

I investigated a workaround to autostart the capture service without rebooting the tv or disabling the quick start. I used home assistant to turn off and on the capture service once the tv turned on. If someone is interested in it .. Don't know if this is the right place for this.

yes i am interested in can you post it ?

wehrstedt commented 2 years ago

I investigated a workaround to autostart the capture service without rebooting the tv or disabling the quick start. I used home assistant to turn off and on the capture service once the tv turned on. If someone is interested in it .. Don't know if this is the right place for this.

yes i am interested in can you post it ?

  1. Enable SSH access on your tv.
  2. Place your public key on your tv for connecting via ssh without password
  3. Create the following script in /home/root on your tv:
    
    root@LGwebOSTV:~# cat my-piccap-service.sh
    #!/bin/bash

set -e luna-send -d -n 1 "luna://org.webosbrew.piccap.service/$1" "{ \"method\": \"$1\"}" &

4. Create a shell command in home assistant (`configuration.yaml`). You have to change the path to your private key (im using docker and had to mount my key in the home assistant container):
```yml
shell_command:
  piccap_capture_service: 'ssh -i "/config/.ssh/id_rsa" -o "StrictHostKeyChecking=no" root@<your-tv-ip> "bash my-piccap-service.sh {{ command }}"'
  1. Create an automation which triggers when your tv turns on:
    - service: shell_command.piccap_capture_service
    data:
    command: stop
    - delay:
    hours: 0
    minutes: 0
    seconds: 5
    milliseconds: 0
    - service: shell_command.piccap_capture_service
    data:
    command: start

I don't know if its necessary to stop the service first. But it works. And I dont know why the luna command has to be launched as a background service (&). But without the command gets not executed.

gomble commented 2 years ago

in which format is your ssh key ? i got following error: ➜ /config ssh -i "/ssl/lg_homeassistant_private" -o "StrictHostKeyChecking=no" root@192.168.178.36 "bash my-piccap-service.sh {{ command }}" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0744 for '/ssl/lg_homeassistant_private' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "/ssl/lg_homeassistant_private": bad permissions

My Public key: lg_homeassistant_private image

public key in authorization file: image

Informatic commented 2 years ago

Permissions 0744 for '/ssl/lg_homeassistant_private' are too open. That's a good summary. You first need to run:

chmod 0600 /ssl/lg_homeassistant_private
gomble commented 2 years ago

Permissions 0744 for '/ssl/lg_homeassistant_private' are too open. That's a good summary. You first need to run:

chmod 0600 /ssl/lg_homeassistant_private

okay its working thank you 👍

Laudings commented 2 years ago

Hello,

i have also the problem that the autostart doesn't work. If i open piccap manuel, than it works. Setting is new 2020+ tv / video capture / graphic capture. I think it worked until there was a update from the tv. but root is still ok says webosbrew. Can I just root the TV again to be sure that this is not the problem or will this cause other problems? Thank you in advance!

Larsen23 commented 2 years ago

Hi Is there any other solution to this issue? Because the app doesn't start for me either. It only works if you send the TV to the reboot from the app itself. Larsen

lightzhuk commented 2 years ago

I investigated a workaround to autostart the capture service without rebooting the tv or disabling the quick start. I used home assistant to turn off and on the capture service once the tv turned on. If someone is interested in it .. Don't know if this is the right place for this.

yes i am interested in can you post it ?

  1. Enable SSH access on your tv.
  2. Place your public key on your tv for connecting via ssh without password
  3. Create the following script in /home/root on your tv:
root@LGwebOSTV:~# cat my-piccap-service.sh
#!/bin/bash

set -e
luna-send -d -n 1 "luna://org.webosbrew.piccap.service/$1" "{ \"method\": \"$1\"}" &
  1. Create a shell command in home assistant (configuration.yaml). You have to change the path to your private key (im using docker and had to mount my key in the home assistant container):
shell_command:
  piccap_capture_service: 'ssh -i "/config/.ssh/id_rsa" -o "StrictHostKeyChecking=no" root@<your-tv-ip> "bash my-piccap-service.sh {{ command }}"'
  1. Create an automation which triggers when your tv turns on:
- service: shell_command.piccap_capture_service
  data:
    command: stop
- delay:
    hours: 0
    minutes: 0
    seconds: 5
    milliseconds: 0
- service: shell_command.piccap_capture_service
  data:
    command: start

I don't know if its necessary to stop the service first. But it works. And I dont know why the luna command has to be launched as a background service (&). But without the command gets not executed.

Welcome. This looks like exactly what I need. but lack of knowledge to setup ssh connection(

TBSniller commented 2 years ago

Autostart is already fixed in newer development versions. If you aren't able to connect to your TV using SSH, just wait a bit more until release.

denimjeans commented 2 years ago

@TBSniller :

  1. how to we start & stop the service.
  2. As the autorun does not work, therefore I need to STOP and START manually, sometimes it happens that the service does not start anymore, then I need to reboot completely, any chance via SSH? What the exact command to start / stop the service
  3. Are there any precompiled more recent development versions avaiable? I dont have any enviroment setup yet, therefore I am asking. When is the new release planned approx?
mksy commented 2 years ago

2. sometimes it happens that the service does not start anymore, then I need to reboot completely

try killall -9 hyperion-webos via ssh and start should work

denimjeans commented 2 years ago
  1. sometimes it happens that the service does not start anymore, then I need to reboot completely

try killall -9 hyperion-webos via ssh and start should work

thank you, and restarting (starting) ? hyperion-webos & ?

mksy commented 2 years ago

luna-send -n 1 'luna://org.webosbrew.piccap.service/start' '{}'

mksy commented 2 years ago

in my case, I created a script on the TV, and call it via SSH twice if the autostart does not work

#!/usr/bin/sh
pc_status=`luna-send -n 1 'luna://org.webosbrew.piccap.service/start' '{}'`
if echo $pc_status | grep -q '{"returnValue":false}'; then
    killall -9 hyperion-webos
    luna-send -n 1 'luna://org.webosbrew.piccap.service/stop' '{}'
fi
denimjeans commented 2 years ago

thanks @mksy, I will give it a try. Looks good.

TBSniller commented 2 years ago

With latest release we reworked almost anything. Please check it out, it should work now for webOS 3.4 and above.

denimjeans commented 2 years ago

Thanks for the new version. But its now even worse. Need to reboot to get it working. Before manul restarting worked at least with 0.23

TBSniller commented 2 years ago

@denimjeans Can you please create an issue here https://github.com/webosbrew/hyperion-webos/issues ? We would also need some logs. You can get them in Log Tab in PicCap -> First set it up using buttons in log tab -> Then produce your problem -> then get last log -> Put the picture in your issue.

You can also get logs directly from CLI by manually running it: https://github.com/webosbrew/hyperion-webos#running Make sure to kill proccess kill -9 $(pidof hyperion-webos) and PicCap before

denimjeans commented 2 years ago

@TBSniller thank you. issues opened here ->

https://github.com/webosbrew/hyperion-webos/issues/95

for everyone who has the same issue. I know that there are at least 2 ppl with the same issue

denimjeans commented 2 years ago

@TBSniller one thing more: could you please let me know on how to downgrade from 0.41 to 0.23. I have managed to copy the 0.23 ipk file to /tmp. But not sure on how to install now? ipkg and opkg not working here. thanks

TBSniller commented 2 years ago

@TBSniller one thing more: could you please let me know on how to downgrade from 0.41 to 0.23. I have managed to copy the 0.23 ipk file to /tmp. But not sure on how to install now? ipkg and opkg not working here. thanks

@denimjeans sure, you can use Install command mentioned here: https://github.com/TBSniller/piccap#manual-way Just replace it with your filename. When its finished you can exit it with CTRL+C

Btw Just make sure to uninstall latest version before installing the old one

finipini commented 1 year ago
luna://org.webosbrew.piccap.service/$1

hey this still works for you?

I would like to turn on and off piccap from ha but i am missing something copying your way. I put a public key in my tv, and placed the private one in a file in ha but the shell command always gives de error 255.

edit. actually i wanted to ask that to @lightzhuk, since i was trying to do the way he didi it, sorry.

shedman214 commented 1 month ago
command: stop

I'm getting an error when i call service of the shell command

Identity file /config/.ssh/id_rsa not accessible: No such file or
  directory.

image