Multiple emonHub_Interfacer on one Raspberry Pi?

Hello,

I am running the latest ready-to-go-image of the OEM on RaspberryPi with the RFM2Pi Module and the emonTX V3 Discrete Sampling. Its working fine.

Now I would like to add a Smart Meter that is according to the german Standard. It gives out an encoded Datapackage via USB (Smart Message Language(SML)). I would like to receive these Datapackages with emonHUB and interpret it before commiting the data to my local emoncms (still on the SD card) using the regular emonHub_reporter.

My question:

Is it possible to run several emonHub_Interfacer instances parallel? So I want the data from my emonTX V3 - Node AND the data from the Smart Meter, both received and interpreted with one raspberry Pi running emonhub.

 

Thanks for any hints and help!

pb66's picture

Re: Multiple emonHub_Interfacer on one Raspberry Pi?

Hi, Yes it is totally possible to create several interfacer instances to create another interfacer you just need to define it in the emonhub.conf.

A EmonHubSerialInterfacer can be created to point to the USB port/device. I suspect it is highly unlikely the message format will match what is expected by emonHub so you would probably be better off writing a custom interfacer that can communicate with your meter. The JeeInterfacer also inherits from the SerialInterfacer so you could use that as a guide to create a simpler CustomInterfacer..(some posts on using EmonHubSeriaIinterfacer)

Alternatively you could write a freestanding script to listen for and reformat the messages, then pass them into emonhub via a SocketInterfacer (a post on using EmonHubSocketInterfacer)

The latter is probably easier and running the script separately gives you a chance to play around a bit to get what's needed up and running without impacting what you currently have, this script could then be ported into a CustomInterfacer.

Hopefully there's enough there to get you started,  

Paul

anjur's picture

Re: Multiple emonHub_Interfacer on one Raspberry Pi?

Hey Paul,

 

thank you for the quick and detailed answer. I think I would like to keep the original sourcecode as it is and go with the script-solution for now. The "Socket" is an internal communication-channel? Meaning that i dont need to weld anything or connect GPIOS or something hardware-related, right? (I am still pretty new to software architecture :) )

I will let you know how it works.

 

juri

[Do not duplicate posts. If your post is held for moderation, please wait for it to be attended to.]

pb66's picture

Re: Multiple emonHub_Interfacer on one Raspberry Pi?

Sockets are a fairly universal way of communicating, you can find loads of info on sockets out there on the WWW. Looking at the Python docs for the socket module may help, it could help understand both what the emonhub code is doing and what the previously linked socket example is doing. 

You can see a different example on the git repo for oem gateway (emonHub's predecessor) although the naming is slightly different the concept is exactly the same.

Once you have a SocketInterfacer listening to a Port you can send data in the correct (nodeid,val1,val2,va3) format from any script to that port for emonHub to forward to emonCMS.

​By default emonHub will add a timestamp on receipt but if you have ready time stamped data from your meter, that behavior can be altered to accept the data in a pre-timestamped format (unixtime,nodeid,val1,val2,va3).

You may have to add the port to the "allowed" list in UFW (uncomplicated firewall) if using the OEM SD card image. The port will be accessible from anywhere on your LAN not just the Pi. 

Paul

 

anjur's picture

Re: Multiple emonHub_Interfacer on one Raspberry Pi?

The SocketInterfacer with the Python-Script that is in the linked forumpost works really good. I can see the data I send with the script on emoncms.

I am now trying to get the libSML (which is written in C) working with Python. I work with swig, but its giving me a real hard time...

I might have to decode the Protocoll on my own. I will keep you up to date.

Comment viewing options

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