How can I make 2 EmonPis communicate over Ethernet?

I have an EmonPi in some outbuildings which is logging my Solar PV and Electric Car charging. I have another one in the house for grid Import/Export & Hot water diversion monitoring. So 4 feeds in all. Both systems are logging to and all is well.

However from my previous system I have 2 EmonGLD displays which I had customised exactly how I wanted. They even told me my profit (or loss) for the day so far. I'd like to use these again and I have no problem sending packets over 868MHz from the unit in the house, however the one in the outbuildings is just too far away with too many intervening stone walls. They are both on the same Ethernet network however.

I would like to be able to get the figures from the outbuildings unit to the house one. I'm not sure if I can do this with the emoncms on the EmonPis. (One is set to node 5 and the other is node 6). It didn't show up as an input when I tried to configure one to send to the other. So I thought I'd just write a program to send the data over directly to a shared file or a socket.

I can ssh to both of them (using Putty) and I've installed Samba server & client on each of them however they can't see each other and I can't see either of them from a windows PC. I can ping each one from the other.

So they are both definitely on the network at the addresses I expect and both sending data to but I can't see either on the network. I tried using NFS too but that doesn't work either.

I have another Raspberry Pi and I can see it just fine. I'm a software developer (albeit in windows) and not usually stumped by things like this.

Is there something special about the setup of Raspbian on the EmonPi? I know about using rpi-rw to allow changes to be written to the SD card but is there anything else I should know?

Or indeed am I going about this the wrong way and there's an easier way to get the logged values from one EmonPi to the other over an Ethernet network?

Thanks for any assistance.


Ian Eagland's picture

Re: How can I make 2 EmonPis communicate over Ethernet?


You could use the mqtt inputs and outputs. A little tricky to set up but I have done it and it works. My mqtt broker (mosquitto) is on a different Pi but I think you could install it on one of the Pi's along side emoncms.

Discussion of setting it up here:




Edit - fixed link - BT

pb66's picture

Re: How can I make 2 EmonPis communicate over Ethernet?

Hi Brian, a couple of possibilities from what you've told us, firstly if you have 2 emonPi's on your network they will both be claiming to be "//emonpi", try renaming one, you can use "sudo raspi-config" to change host hostname in one go.

The default emon-pi image has emoncms enabled by default but it isn't mandatory to either and certainly isn't ideal to keep both as that gives you fragmented data which isn't available outside your LAN.

If you are not running another local emoncms instance Ideally you could the garage emonPi to forward only, to both your account and your local house based emoncms, however I'm not entirly sure the input api is fully functional on the emon-pi's low-write emoncms so try sending some data before making any drastic moves. with only one local emoncms server you can then forward port 80 (8080) to the house emonPi at your router for access outside the LAN.

If you have data from both emonPi's arriving at you could just write a little script to fetch the feed data you need for your glcds from and route it to the glcds locally. option 1 write a little script to "fetch" and publish to mqtt on the house emonpi and configure it to broadcast the subscribed data or option 2 is to edit emonhub to "fetch" the data from emoncms.og and broadcast along with the glcd time updates.

Further to Ian's points, both of your emonPi's will be running thier own MQTT brokers already so that could also create some confusion if you publish to one and subscrib to the other wonder where your packets are going.


bdhughes's picture

Re: How can I make 2 EmonPis communicate over Ethernet?

Hi Ian and Paul

Thanks for your replies. A good point on the hostnames being identical Paul. I changed those and rebooted but no change on the networking. I'll have to investigate the mqtt but it does look complicated, Ian.

I thought I'd try setting up a socket connection instead. I wrote some code for a server & client in Python. This works fine between 2 windows PCs but not at all between the 2 EmonPis. If I run the client on the Pi and the server on a windows PC it also works. However it won't work the other way around. The Pis just won't accept a connection.

I then thought I'd install tightvnc on the Pis to see if I could connect that way. I've done this on my other Raspberry pi but I can't connect to the EmonPis. I used apt-get to install tightvncserver and tried running it from ssh and by running it from init.d. Neither method is working.

Has anyone else been able to use vnc to an EmonPi. I'm beginning to think there's something missing from Raspian on these units. I have done sudo apt-get update and sudo apt-get upgrade but still no joy.

So my conclusion so far is that I can make connections outwards from the EmonPi but the only connections I've been able to make inwards are via ssh and http.





pb66's picture

Re: How can I make 2 EmonPis communicate over Ethernet?

If you are using a windows machine to access the network you may well need to run " IPConfig /flushDNS " (as an administrator) to for allow the hostname a chance to take effect.

The emonPi's run UFW (Uncomplicated FireWall) so any inward connections to the mqtt brokers, vnc etc will require the relative ports added to the allowed list.

I use xrdp on the Pi's which is a remote desktop without any problems so vnc should be ok.


bdhughes's picture

Re: How can I make 2 EmonPis communicate over Ethernet?

Hi Paul

It was the ufw firewall stopping my sockets experiment so I'm able to write code to communicate between the EmonPis now. Also vnc is working. I still can't connect via windows networking but that is not important to me now and it's probably due to some part of the configuration I've got wrong.

So thanks for that insight. I hadn't heard of ufw before.



Comment viewing options

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