OTmonitor als daemon op Raspberry Pi

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

Moderator: hvxl

Nightlens1
Starting Member
Starting Member
Posts: 13
Joined: Wed Mar 04, 2015 11:07 pm

Re: OTmonitor als daemon op Raspberry Pi

Post by Nightlens1 »

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: Wed Mar 04, 2015 11:07 pm

Re: OTmonitor als daemon op Raspberry Pi

Post by Nightlens1 »

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.
yjb
Member
Member
Posts: 211
Joined: Fri Apr 17, 2009 1:15 pm
Location: Venhuizen, Netherlands

Re: OTmonitor als daemon op Raspberry Pi

Post by yjb »

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
Nightlens1
Starting Member
Starting Member
Posts: 13
Joined: Wed Mar 04, 2015 11:07 pm

Re: OTmonitor als daemon op Raspberry Pi

Post by Nightlens1 »

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
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: OTmonitor als daemon op Raspberry Pi

Post by marcelr »

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 8:43 am, edited 1 time in total.
Nightlens1
Starting Member
Starting Member
Posts: 13
Joined: Wed Mar 04, 2015 11:07 pm

Re: OTmonitor als daemon op Raspberry Pi

Post by Nightlens1 »

Hi marcel,
Thanks for explaining. Learned something more today :)
Post Reply

Return to “Opentherm Gateway Forum”