OTmonitor als daemon op Raspberry Pi

This Forum is about the Opentherm gateway (OTG) from Schelte

Moderator: hvxl

Re: OTmonitor als daemon op Raspberry Pi

Postby Nightlens1 » Tue Sep 15, 2015 10:13 pm

Hi guys
With a lot of trial and error, I have gotten met OTGW to work with my Valliant CV, OTmonitor to run on a raspberry pi, and to connect to the pi via the webserver.
Next I would like to:

-have OTmonitor to run when the pi starts.
-send the value of parameters of my choice to log on thingspeak.

To have the OTmonitor run at start-up, I understand i need to have it start via a deamon. I tried to use the above examples, but they do not give all the details needed for a complete linux noob (but, I'm learning quick :) to get it work. I would guess that I just need to add a "start" OTmonitor in cron via @reboot. (this works well for me to start python in order to run a script that pulls evohome data and dumps it at thingspeak).

Any advice (with picture :lol: ) how I get it to work?

Regards, Rutger
Nightlens1
Starting Member
Starting Member
 
Posts: 13
Joined: March 2015

Re: OTmonitor als daemon op Raspberry Pi

Postby Nightlens1 » Wed Sep 16, 2015 9:23 pm

Ok, the learning curve goes quick :)
Playing around a bit solved the problem, otmonitor is now running in the background.

For the next person, this is what I did.

type into the terminal:
sudo nano /etc/profile
So otmonitor is started by a script named profile that is loaded at startup

Then add to the bottom:
Sudo -u pi /home/pi/Desktop/otmonitor --webserver 8080 --daemon /dev/ttyUSB0 &
Save changes to profile and reboot.

I had to remove the "-ahf", not sure what it is used for, perhaps part of the name of the file. Furthermore I changed the port to 8080, as that is also indicated when you load the otmonitor.
Nightlens1
Starting Member
Starting Member
 
Posts: 13
Joined: March 2015

Re: OTmonitor als daemon op Raspberry Pi

Postby yjb » Wed Sep 16, 2015 9:50 pm

Yikes,

/etc/profile is normally executed when a user logs into the system. There is no guarantee it will be executed upon a reboot.
In most 8NIX implementations the correct way would be to use init.d scripts.

Please check this pages for PI specifics:

raspberrywebserver.com/serveradmin/run- ... rt-up.html
yjb
Member
Member
 
Posts: 187
Joined: April 2009
Location: Venhuizen, Netherlands

Re: OTmonitor als daemon op Raspberry Pi

Postby Nightlens1 » Sat Sep 19, 2015 10:45 pm

Hi yjb,
Thanks for your reply. Based on your comment, I assume etc/profile works for me since my RasPi logs in automatically at boot, since it starts in raspbian.
Just for my understanding, why would init.d be prefered? Because of the following?

Sometimes when a computer is shutdown, services need to be stopped in a controlled way. Programs may need to finish logging data or release lock files before they are terminated. If a script is started using cron or rc.local, it will simply stop when the Pi is shutdown. Using the init.d method to control scripts means that when your Pi shuts down, Linux will gracefully shutdown the script so that it has a chance to finish off any final tasks.



regards, rutger
Nightlens1
Starting Member
Starting Member
 
Posts: 13
Joined: March 2015

Re: OTmonitor als daemon op Raspberry Pi

Postby marcelr » Sat Sep 19, 2015 11:13 pm

The init.d scripts control startup and (controlled) stopping of processes during boot and shutdown or reboot. They are executed always, unless you unplug the machine to shut it down. Normally, on linux machines, /etc/profile does not get executed, unless someone logs in. In a headless machine it is quite common to not have anyone logged in at any time. Furthermore, the profile is typically set for a specific user. If your application runs with another userid, the profile may not be set, or in a different way.

So: put everything that you need to start up at boot time in /etc/rc.d/rc.local. This script is the last one to be executed before the login prompt is presented. So all supporting processes your process might need (ethernet support, clock time, web server, ssh daemon, whatever.) are up and running by then.

grtz,

marcelr
Last edited by marcelr on Sun Sep 20, 2015 7:43 am, edited 1 time in total.
marcelr
Global Moderator
Global Moderator
 
Posts: 1074
Joined: May 2012
Location: Ehv

Re: OTmonitor als daemon op Raspberry Pi

Postby Nightlens1 » Sat Sep 19, 2015 11:19 pm

Hi marcel,
Thanks for explaining. Learned something more today :)
Nightlens1
Starting Member
Starting Member
 
Posts: 13
Joined: March 2015

Previous

Return to Opentherm Gateway Forum

Who is online

Users browsing this forum: No registered users and 1 guest