OpenMarine

Full Version: Launch the ADS1115 tool automatically at startup?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I launch the ADS1115 tool automatically at startup?

I can run the following form the terminal successfully
python /home/pi/.config/openplotter/tools/analog_ads1115.py

But if I try to call this from rc.local it fails with SUDO user error key.

I also don't particularly want to launch it before openplotter is finished as I suspect that this could cause problems down the line.
(2018-03-30, 03:51 PM)garysmith Wrote: [ -> ]How do I launch the ADS1115 tool automatically at startup?

I can run the following form the terminal successfully
python /home/pi/.config/openplotter/tools/analog_ads1115.py

But if I try to call this from rc.local it fails with SUDO user error key.

I also don't particularly want to launch it before openplotter is finished as I suspect that this could cause problems down the line.

I just stumbled across your question, and an the legacy doc here answers your first question. Don't know about your timing question.

https://sailoog.gitbooks.io/openplotter-documentation/content/en/standalone-tools.html

Hope that helps.
You could try startup in /home/pi/.config/autostart this has scripts to run after login. This is where the openplotter startup script is started. It also starts other scripts.
Hi, im not sure what is the analog_ads1115.py but :

The sudo command need some user's specific environement variables to work.    
If I remember well, rc.local is executed on each multiuser runlevels BUT it is done by the runlevel1 root user (witch don't have environment variables like $HOME and $PATH set.).

Therefor it's not realy the place for using sudo ....and mainly you just don't need it as you are already root.


----

IF
analog_ads1115.py is a demon or some kind of background task.
Creating a .service file and enable it with systemctl would probably be the proper thing to do.

Other wise if it's some Graphical User Interface application,
/home/pi/.config/autostart will be a good place so your app.


The point is you should not put any demon or background running task in your autostart. 
Autostart should be reserved for thing that depend on the graphical interface and have no reasons to be without it.  
Otherwise, If something trivial ( like vlc or pdfviewer ) make your Xorg crash. your analog_ads1115.py will be killed with the rest.

--Fred
Edit openplotter.conf. Change this
Code:
['Analog ads1115', 'put analog values to SignalK', 'analog_ads1115.py', '0']

to this
Code:
['Analog ads1115', 'put analog values to SignalK', 'analog_ads1115.py', '1']
(Look into the docs as svtgd said (analog_ads1115.py is a normal python program. It starts when you press the start buttom or it autostarts on every boot if you change the 0 to 1))