onlaj / Piano-LED-Visualizer

Piano LED Visualizer: Connect an LED strip to your Raspberry Pi and create an immersive visual experience for your piano playing
MIT License
513 stars 111 forks source link

No auto start, unless ssh? #355

Closed Logan-Orr closed 1 year ago

Logan-Orr commented 2 years ago

Hello! In the new PlV 1.3 update, the autostart is no longer working, i know how to manually start it and it works, but when i put the sudo python3 /home/Piano-LED-Visualizer/visualizer.py & in etc profile, it does not start, but when i ssh into it, it automatically starts up and the menu is shown with no commands entered, and if i close the ssh window, it stops working, how can i fix this?

onlaj commented 2 years ago

Hello. https://github.com/onlaj/Piano-LED-Visualizer/issues/349#issuecomment-1109641040

I will try to fix that in future updates, for now try this workaround.

Logan-Orr commented 2 years ago

So I looked at that yes, where would i find the crontab?

onlaj commented 2 years ago

Type: sudo crontab -e

Logan-Orr commented 2 years ago

Thanks bro u respond so quickly

Logan-Orr commented 2 years ago

Also, this is a weird error, the visuizer is working, but i can not enter any commands because of this infinite loop of error 491B7B68-C4FA-4E13-BB8E-D06EC7CFFA4A

onlaj commented 2 years ago

Just press CTRL + C

Logan-Orr commented 2 years ago

Ok

Logan-Orr commented 2 years ago

Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Socket listening on: 192.168.1.185:8765 Traceback (most recent call last): File "/home/Piano-LED-Visualizer/visualizer.py", line 17, in Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner from webinterface import webinterface File "/home/Piano-LED-Visualizer/webinterface/init.py", line 43, in from webinterface import views File "", line 1007, in _find_and_load self.run() File "/usr/lib/python3.9/threading.py", line 892, in run File "", line 982, in _find_and_load_unlocked File "", line 925, in _find_spec File "", line 1349, in find_spec self._target(*self._args, **self._kwargs) File "/home/Piano-LED-Visualizer/webinterface/init.py", line 36, in start_server File "", line 1321, in _get_spec File "", line 1450, in find_spec asyncio.run(main()) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run File "", line 1490, in _fill_cache

Logan-Orr commented 2 years ago

Am i missing a requirement?

onlaj commented 2 years ago

Are you trying to run script manually now or are those logs from the start-on-boot script?

Logan-Orr commented 2 years ago

Start on boot

onlaj commented 2 years ago

Then don't worry about it. If it's the same case as in the other issue, then it's an error caused by the script trying to run before getting a wifi connection.

It can be temporarily fixed by adding a delay to the script's start.

Logan-Orr commented 2 years ago

Ohhh, it could possibly be from the sudo python3 /home/piano etc. start script that i left in profile

Logan-Orr commented 2 years ago

Yea thats what it was

Logan-Orr commented 2 years ago

I have a idea, i was using a synthizer that was for raspi and it was headless, it would be awesome if you could combine the synth with the plv, and have a soundfont menu, the installation was one command and was fast, i can send you a link

fredpineau commented 2 years ago

Hello, I have created a specific systemctl service in /usr/lib/systemd/system like this one and it works fine on my side:

pi@raspberrypi:/usr/lib/systemd/system $ cat piano-visualiser.service [Unit] Description=Piano Visualizer After=network-online.target Wants=network-online.target

[Install] WantedBy=multi-user.target

[Service] ExecStart=sudo python3 /home/pi/Piano-LED-Visualizer/visualizer.py --display 1in3 Type=simple User=pi Group=pi WorkingDirectory=/home/pi

and then enable it :

systemctl daemon-reload systemctl enable piano-visualiser.service