Use Emonhub with RPICT: Difference between revisions

From lechacal
Jump to navigation Jump to search
 
Line 2: Line 2:


=Overview=
=Overview=
DO NOT USE THIS  GUIDE WITH EMONPI / EMONCMS IMAGE.
/!\ DO NOT USE THIS  GUIDE WITH EMONPI / EMONCMS IMAGE. /!\
 
This is for use on a native Raspbian image. If using the emoncms image this is not necessary as emonhub is already installed.
This is for use on a native Raspbian image. If using the emoncms image this is not necessary as emonhub is already installed.



Latest revision as of 09:48, 3 May 2022


Overview

/!\ DO NOT USE THIS GUIDE WITH EMONPI / EMONCMS IMAGE. /!\

This is for use on a native Raspbian image. If using the emoncms image this is not necessary as emonhub is already installed.

This document will demonstrate how to prepare the rasberrypi to use Emonhub with the RPICT.

Emonhub will be used to forward the data from the RPICT series board and forward them to Emoncms.

We assume here a fresh install of raspbian has been installed and all steps to get the serial port operating have been carried out. See Howto_setup_Raspbian_for_serial_read.

Also make sure the RPICT board supports Emonhub format as output.

Install Emonhub

This is not necessary if you are using the image from Emoncms as emonhub is already installed.

To install emonhub we would recommend following the steps indicated on the emonhub github page.

We have summarized the commands to executre below:

wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
sudo apt-get update
sudo apt-get install -y mosquitto python-serial python-configobj
sudo easy_install -U pip
sudo pip install paho-mqtt
sudo pip install pydispatcher

Open and modify this file below:

sudo nano /etc/mosquitto/mosquitto.conf

Set persistence parameter as false

persistence false
cd
mkdir data
git clone https://github.com/openenergymonitor/emonhub.git && emonhub/install
sudo service emonhub start

RPICT configuration

The format parameter should be set to emonhub, code number 3.

format = 3

Emonhub configuration

The configuration file for emonhub is located in /home/pi/data

Open this file. Delete all its content and replace with this one below:

[hub]
### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
### see here : http://docs.python.org/2/library/logging.html
loglevel = DEBUG #(default:WARNING)

[interfacers]

[[SerialDirect]] 
  Type = EmonHubSerialInterfacer
  [[[init_settings]]]
      com_port = /dev/ttyAMA0
      com_baud = 38400
    [[[runtimesettings]]]
     pubchannels = ToEmonCMS,

[[emoncmsorg]]
   Type = EmonHubEmoncmsHTTPInterfacer
   [[[init_settings]]]
   [[[runtimesettings]]]
       subchannels = ToEmonCMS,
       #url = http://localhost/emoncms #uncomment to save on local pi
       apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       senddata = 1                    # Enable sending data to Emoncms.org
       sendstatus = 1                  # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
       sendinterval= 30                # Bulk send interval to Emoncms.org in seconds
        

[nodes]

[[11]]
  nodename = my_RPICT7V1
  [[[rx]]]
     names = RP1, RP2, RP3, RP4, RP5, RP6, RP7, Irms1, Irms2, Irms3, Irms4,Irms5,Irms6,Irms7,Vrms
     scales = 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
     units =W,W,W,W,W,W,W,mA,mA,mA,mA,mA,mA,mA,V


Change the node information as relevant. Also change the apikey to the one that emoncms gave you.