Gateway/RPi on standard Debian Wheezy

Hi All,

Is it possible to install the gateway on a standard Raspbian wheezy? instead of the standard SD card image?

Is it the same/similar to this post? or am I going to missing a lot of things?

http://emoncms.org/site/docs/raspberrypigatewaybuild

Thanks Josh

Jérôme's picture

Re: Gateway/RPi on standard Debian Wheezy

Hi.

I develop the gateway on a Raspbian system.

It is RW. I didn't make it read-only, although I try to limit logging and I don't use local emoncms instance.

Follow the instructions you pointed to in order to have the RFM2Pi board working.

For the gateway installation, there are indications in the readme (https://github.com/Jerome-github/oem_gateway) but I suppose the instructions on your help page should work just as fine.

joshpond's picture

Re: Gateway/RPi on standard Debian Wheezy

Thanks, I'm not the greatest at all this but I'll have a read and a play around with what you linked.
I plan on running emoncms on my server so hopefully not too much written to the sd card.
Josh

Jérôme's picture

Re: Gateway/RPi on standard Debian Wheezy

In the gateway parameters, set logging level to CRITICAL. Turn it to DEBUG only if you have issues to investigate.

joshpond's picture

Re: Gateway/RPi on standard Debian Wheezy

Okay I've run up to:

git clone http://github.com/Jerome-github/oem_gateway.git

It has copied everything to /home/pi/oem_gateway/

I'm trying to set it up to run as a daemon so it stays on and runs on boot up. I've run this fine: 

Run as a daemon (optionnal)

Grant write privilege to logging file (skip if logging is not used)

Create groupe emoncms and make user pi part of it

sudo groupadd emoncms
sudo usermod -a -G emoncms pi
Create a directory for the logfile and give ownership to user pi, group emoncms

sudo mkdir /var/log/oemgateway
sudo chown pi:emoncms /var/log/oemgateway
sudo chmod 750 /var/log/oemgateway

I've then copied the file across and edited:

sudo cp oemgateway.init.dist /etc/init.d/oemgateway

sudo nano /etc/init.d/oemgateway

I'm not 100% sure what to change with the arguments but the path I think is this:

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenEnergyMonitor Gateway"
NAME=oemgateway
#Â Enter your installation path here
DAEMON=/enter/your/installation/path/here/$NAME
#Â Specify command line arguments here
DAEMON_ARGS="--logfile /var/log/oemgateway/oemgateway.log"
#DAEMON_ARGS="--logfile /var/log/oemgateway/oemgateway.log --config-file /path/$

DAEMON=/home/pi/oem_gateway

My questions:

1) is that correct? What is the $NAME part. I can't test it as

2) (after running "sudo chmod 755 /etc/init.d/oemgateway") when I run 

sudo /etc/init.d/oemgataway start

I get

sudo: /etc/init.d/oemgataway: command not found

The file is there but I'm not sure what is happening.

Thanks Josh

 

Jérôme's picture

Re: Gateway/RPi on standard Debian Wheezy

TL;DR, your config:

DAEMON=/enter/your/installation/path/here/$NAME
DAEMON_ARGS="--logfile /var/log/oemgateway/oemgateway.log"

------------------------------------------------------------

# Customize init script: path, command line arguments

# Enter your installation path here
DAEMON=/enter/your/installation/path/here/$NAME
# Specify command line arguments here
DAEMON_ARGS="--logfile /var/log/oemgateway/oemgateway.log"
#DAEMON_ARGS="--logfile /var/log/oemgateway/oemgateway.log --config-file /path/to/config/file"

You need to change the install path, and the arguments.

Your path is /home/pi/oem_gateway/

$NAME refers to the line above. It will be replaced by oemgateway.

You need to enter /home/pi/oem_gateway/$NAME, which resolves as DAEMON=/home/pi/oem_gateway/oemgateway.

The possible arguments are --logfile /var/log/oemgateway/oemgateway.log and --config-file /path/to/config/file.

You don't need to specify the config-file path since you're using the default path if you followed the steps in the readme. You could skip the --logfile argument to disable logging the hard way, but it's fine to keep it here and set DEBUG as CRITICAL. You won't get any logging, but it will be easier to activate it the day you need it.

joshpond's picture

Re: Gateway/RPi on standard Debian Wheezy

Thanks for the help with the paths.

I  figured out why I was getting this:

when I run

sudo /etc/init.d/oemgataway start

I get

sudo: /etc/init.d/oemgataway: command not found

It was because I was copy and pasting the command from the readme. there is an a there instead of an e.

It reads oemgataway not oemgateway.

 

Thanks Josh

Jérôme's picture

Re: Gateway/RPi on standard Debian Wheezy

Oooooops, my bad.

Thanks for the feedback. I fixed the readme.

BTW you can use

sudo service oemgateway start

Easier to memorize.

joshpond's picture

Re: Gateway/RPi on standard Debian Wheezy

Thanks for all the help, finally got it all going.

One thing I had to change was the oemgateway.conf file to log to emoncms.org

Original file:

 [[emoncms_remote]]

    type = OemGatewayEmoncmsBuffer
    [[[init_settings]]]
    [[[runtime_settings]]]
        domain = domain.tld
        apikey = 673e7954c00f635f953f18b79a881859
        protocol = http://
        active = True
        path = /emoncms

I had to change the domain and remove the path to:

[[emoncms_remote]]
    type = OemGatewayEmoncmsBuffer
    [[[init_settings]]]
    [[[runtime_settings]]]
        domain = emoncms.org
        apikey = 673e7954c00f635f953f18b79a881859
        protocol = http://
        active = True
        path =

 

Not sure if that is the expected behavior. I've now got to sort out my feeds and stuff.

Thanks Josh

Jérôme's picture

Re: Gateway/RPi on standard Debian Wheezy

Your new config is correct. We definitely need to provide better sample configs.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.