# Installing Emonhub on a PC

**URL:** <https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527>\
**Category:** emonHub\
**Created:** [31 July 2019 21:49 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527 "2019-07-31T21:49:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [31 July 2019 21:49 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/1 "2019-07-31T21:49:49Z")

</div>

Hello,

I am trying to install Emonhub on a NUC intel mini PC running Debian Jessie.  
I have been following these instructions( [GitHub - openenergymonitor/emonhub: Python service linking and decoding input to MQTT & Emoncms](https://github.com/openenergymonitor/emonhub) ) but the installation fails because the file structure of my system is different from a Pi.  
After some tweaking I manage to get the emonhub running and posting to MQTT. However the Emoncms MQTT Input Service is not running. Hence no input are appearing.  
Data is sent to the PC via USB by an emontx shield mounted on an arduino. I can see data being posted to emonhub.

Any idea how I can fix the issue of Emoncms MQTT Input Service not running ?  
Is there a “proper” instruction to install correctly emonhub on a PC rather than a PI ?

Thanks 😉

Thierry

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [1 August 2019 17:09 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/2 "2019-08-01T17:09:09Z")

</div>

> [@thierry](#):
>
> I am trying to install Emonhub on a NUC intel mini PC running Debian Jessie.

How have you installed emoncms?

Jessie has some quirks around systemd units and that may be the issue.

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [1 August 2019 20:07 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/3 "2019-08-01T20:07:24Z")

</div>

Hi,

I have installed Emoncms using this method: [emoncms/LinuxInstall.md at master · emoncms/emoncms · GitHub](https://github.com/emoncms/emoncms/blob/master/docs/LinuxInstall.md)  
I think Emoncms is working fine. If I send data trough http I can see the feeds appearing into Emoncms  
The problem is with emonhub. The tutorial I used is for a pi board and not a PC.

I have also tried to install Emoncms on Ubuntu 16.04 (Debian Xenial). Emoncms is working Ok, however I can not install emonhub because in here ([GitHub - openenergymonitor/emonhub: Python service linking and decoding input to MQTT & Emoncms](https://github.com/openenergymonitor/emonhub)) I can find instructions only for Jessie or Wheezy.

Any idea how to install correctly Emonhub on a PC ?

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [1 August 2019 20:19 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/4 "2019-08-01T20:19:44Z")

</div>

We really need to find the time to sort out these docs as they are not really accurate but the focus tends to be on RPi systems.

> [@thierry](#):
>
> However the Emoncms MQTT Input Service is not running.

This may help (follow the MQTT link) [https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/readme.md#system-options](https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/readme.md#system-options). However, there are issues with this on non Stretch setups. You may also find you need some additional Modules as well.

If you do have a Stretch base OS, then you might find more luck with some scripts that are in Alpha stage at the moment [GitHub - openenergymonitor/EmonScripts: Emoncms Stack Installation and Update scripts](https://github.com/openenergymonitor/EmonScripts) - we hope these will effectively replace the install scripts for other Linux OSs eventually.

> [@thierry](#):
>
> The problem is with emonhub.

In the emonhub config file, you should find an HTTP interfacer that uses the HTTP interface to send data to [emoncms.org](http://emoncms.org). If you change that host to your local IP address, and add in the API key, it should work (or if you use an [emoncms.org](http://emoncms.org) account - copy the interface definition).

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [19 August 2019 20:10 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/5 "2019-08-19T20:10:23Z")

</div>

Hello,

Sorry for the very, very late reply (holiday time here in France)

> [@borpin](#):
>
> In the emonhub config file, you should find an HTTP interfacer that uses the HTTP interface to send data to [emoncms.org](http://emoncms.org). If you change that host to your local IP address, and add in the API key, it should work (or if you use an [emoncms.org](http://emoncms.org) account - copy the interface definition).

Thanks for pointing this “solution”. It works. I can use the HTTP interfacer (limited a max rate of every 30s, though) to post to my local machine. This is a good temporary solution.  
However it would be nice to have a proper emoncms installer for a linux distro on a PC and not only for a PI.  
The reason I use a real PC and not a PI is due to SD card corruption. I have never managed to get Emoncms running on a PI more than 6 months in a row 🤕  
The main power supply where I live (in the woods) is really bad with frequent cut off. That may be an explanation. BUT I never have any problem with my 3 linux PC.

Regards,

Thierry

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [20 August 2019 06:20 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/6 "2019-08-20T06:20:34Z")

</div>

There may be a misunderstanding here - Emonhub is an interface that (largely) takes data from a serial interface (such as the [RFM69Pi](https://shop.openenergymonitor.com/rfm69pi-433mhz-raspberry-pi-base-station-transceiver/)) and passes that data on to EmonCMS. It passes data in a number of ways but the most common is via an MQTT Broker or HTTP.

What are you expecting Emonhub to do for you?

Where is the data coming from?

> [@thierry](#):
>
> I can use the HTTP interfacer (limited a max rate of every 30s, though) to post to my local machine. This is a good temporary solution.

Does this mean you have Emonhub installed and running but the MQTT part of Emoncms is not working? I’m not certain that the HTTP interface is limited to 10s.

> [@thierry](#):
>
> However it would be nice to have a proper emoncms installer for a linux distro on a PC and not only for a PI.

It is hoped the scripts will eventually do that to some extent, but as the user base is predominately Pi based, that is always going to be the focus. I run the RFM board and Emonhub on an OrangePi using the HTTP interface. My Emoncms setup is on DietPi on a VM. However, my MQTT broker runs on a different machine. Most complexities can be worked through.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [20 August 2019 08:53 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/7 "2019-08-20T08:53:42Z")

</div>

> [@thierry](#):
>
> Thanks for pointing this “solution”. It works. I can use the HTTP interfacer (limited a max rate of every 30s, though) to post to my local machine. This is a good temporary solution.

The 30s sendinterval can be defined in the interfacer runtimesettings

> <https://github.com/openenergymonitor/emonhub/blob/v2.1.2/conf/emonpi.default.emonhub.conf#L71>

That setting was designed to reduce traffic to [emoncms.org](http://emoncms.org), instead of emonhub sending multiple 10s payloads, it could send all of them in one payload once every 10s, but the default has become 30s. Just reduce it to 10s if you have multiple 10s devices or lower for a less “batched” operation, this setting only throttles the sending so (for example) if you have a 10s device and a sendinterval of 5s, it will still be sent instantaneously as it will always be over 5s since the last send.

The HTTP method is superior to the MQTT method, even on an emonSD. There is no need for this to be a temporary solution, even if you get MQTT fully functioning, I’d recommend staying with the http interfacer to pass data between emonhub and emoncms.

Using HTTP doesn’t mean you cannot still use MQTT to let other devices get at the data, but it does mean theat the most important audience (emoncms) is getting better quality data from emonhub.

> [@thierry](#):
>
> Data is sent to the PC via USB by an emontx shield mounted on an arduino.

So your data is “grouped” into payloads, when this is passed by MQTT it is split into individual topics without timestamps rather than passed as a single array with a timestamp as the http interfacer does. This means that the order of the values can alter between emonhub and emoncms, which can play havoc with your input processing if you reference inputs from any input.

> [@thierry](#):
>
> The reason I use a real PC and not a PI is due to SD card corruption.

You can add a spinnimng disk hdd to a Pi or make the OS read only and just put your data files on a USB stick.

> [@thierry](#):
>
> The main power supply where I live (in the woods) is really bad with frequent cut off.

A simple little 12v battery and mains charger, supplying the Pi via a [3A 12v-5v micro-usb](https://www.ebay.co.uk/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=3A+12v-5v+micro-usb&_sacat=0) dropper would prevent any power interruptions. I also put my router on the UPS so micro-outages do not trigger a router restart and the usual eternal delay before it’s fully back on line (my router is 12vdc, but that varies model by model).

The biggest cause of premature SDcard fails is incomplete writes due to the power failing (or the card being removed) during a write cycle. To prevent failing the card this way either don’t write (RO OS) or don’t lose power (UPS), it’s the only safe way to use an sdcard.

> [@thierry](#):
>
> BUT I never have any problem with my 3 linux PC.

And we should indeed be encouraging the re-purposing of of old tech rather than just promoting the latest model Pi. If the PC works for you then that is great.

> [@thierry](#):
>
> However it would be nice to have a proper emoncms installer for a linux distro on a PC and not only for a PI.

There is work in the pipeline to make the OEM and emon stuff less (emon)Pi centric but it will take some time. The new installer should be hardware agnostic, providing the OS distro is supported, it should work fine and just leave out the more Pi centric bits like the LCD and serial port stuff.

---

<div class="post-metadata">

**Author:** ![Bill.Thomson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/bill.thomson/32/1834_2.png) [@Bill.Thomson](https://community.openenergymonitor.org/u/Bill.Thomson)\
**Post date:** [20 August 2019 11:51 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/8 "2019-08-20T11:51:13Z")

</div>

> [@pb66](#):
>
> And we should indeed be encouraging the re-purposing of of old tech rather than just promoting the latest model Pi.

![thumbsup](https://community.openenergymonitor.org/uploads/default/original/2X/3/3c587556c0cc11389317c03a60788d77ceebd307.gif)

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [20 August 2019 12:02 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/9 "2019-08-20T12:02:16Z")

</div>

Hi to all,

> [@borpin](#):
>
> Does this mean you have Emonhub installed and running but the MQTT part of Emoncms is not working?

Yes that’s perfectly right

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [20 August 2019 12:47 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/10 "2019-08-20T12:47:17Z")

</div>

> [@pb66](#):
>
> The 30s sendinterval can be defined in the interfacer runtimesettings

I have tried already, but it does not work ???

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [20 August 2019 12:50 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/11 "2019-08-20T12:50:12Z")

</div>

> [@pb66](#):
>
> You can add a spinnimng disk hdd to a Pi or make the OS read only and just put your data files on a USB stick.  
> A simple little 12v battery and mains charger…

I know all this workaround but by the time you did all of this and bought all the necessary the parts a second hand mini PC like a NUC is far cheaper, already package neatly and ready to go. It uses only 3W running. Quiet acceptable

---

<div class="post-metadata">

**Author:** ![Bill.Thomson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/bill.thomson/32/1834_2.png) [@Bill.Thomson](https://community.openenergymonitor.org/u/Bill.Thomson)\
**Post date:** [20 August 2019 14:16 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/12 "2019-08-20T14:16:17Z")

</div>

> [@thierry](#):
>
> a NUC is far cheaper

Hi thierry,

The lowest price I can find for a [NUC](https://www.ebay.com/sch/i.html?_from=R40&_nkw=nuc+pc&_sacat=0&_sop=15&rt=nc&LH_BIN=1) is 75 USD. (+ 8 USD shipping)  
(Do you know of a source that sells them for less than 75 USD?)

If one already has a RPi, then adding an external disk drive to it can be done at reasonable cost.

A [16GB SSD](https://www.ebay.com/itm/SanDisk-16GB-SSD-SATA-Solid-State-Drive-SDSA3BD-016G-54-90-13912-016G-Tested/133037226876?hash=item1ef9a2fb7c%3Ag%3AXr0AAOSwK2Jcx45h&LH_BIN=1) can be had for as little as 6 USD  
and a [SATA to USB cable](https://www.ebay.com/itm/USB-3-0-to-2-5-SATA-III-Hard-Drive-Adapter-Cable-UASP-SATA-to-USB3-0-Converter/293086763108?hash=item443d551864:g:ItwAAOSwyZxc2Rcy) is also available for 6 USD.  
(Note, the SSD is not new. i.e. it’s used, but at 6 bucks a pop, one could  
buy a spare and still not spend a lot of money)

Granted a complete NUC is an all-in-one unit, in a nice compact package, and the SSD/USB  
cable add-ons are not, they’re still _very_ affordable at a total cost of 12 USD.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [20 August 2019 14:45 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/13 "2019-08-20T14:45:12Z")

</div>

> [@thierry](#):
>
> > The 30s sendinterval can be defined in the interfacer runtimesettings
> 
> I have tried already, but it does not work ???

In what way does it not work?

Are you running Emonhub on the same machine as Emoncms? What is the data source? Does it need to use emonhub or can it send the data directly?

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [20 August 2019 19:40 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/14 "2019-08-20T19:40:40Z")

</div>

Hi Bill,

> [@Bill.Thomson](#):
>
> The lowest price I can find for a [NUC](https://www.ebay.com/sch/i.html?_from=R40&_nkw=nuc+pc&_sacat=0&_sop=15&rt=nc&LH_BIN=1) is 75 USD. (+ 8 USD shipping)  
> (Do you know of a source that sells them for less than 75 USD?)

50$

> **[Intel DCCP847DYE NUC Celeron 1.1ghz 16gb RAM 256 SSD for sale online | eBay](https://www.ebay.com/p/1521658931?iid=183882639115)**
>
> Find many great new & used options and get the best deals for Intel DCCP847DYE NUC Celeron 1.1ghz 16gb RAM 256 SSD at the best online prices at eBay! Free shipping for many products!

I bought few units in France for 50€ each

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [20 August 2019 19:47 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/15 "2019-08-20T19:47:33Z")

</div>

Hi Brian,

> [@borpin](#):
>
> > > The 30s sendinterval can be defined in the interfacer runtimesettings
> > 
> > I have tried already, but it does not work ???
> 
> In what way does it not work?
> 
> Are you running Emonhub on the same machine as Emoncms? What is the data source? Does it need to use emonhub or can it send the data directl

If I change the value to 10s I still get data in Emoncms every 30s  
Emoncm is running on the same machine as Emonhub.  
Data is sent from an arduino with a emontx shield running a serial\_direct sketch . Arduino is connected to PC via USB.

BTW, thanks to all of you for your great support. 👍

Thierry

---

<div class="post-metadata">

**Author:** ![Bill.Thomson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/bill.thomson/32/1834_2.png) [@Bill.Thomson](https://community.openenergymonitor.org/u/Bill.Thomson)\
**Post date:** [21 August 2019 00:21 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/16 "2019-08-21T00:21:35Z")

</div>

> [@thierry](#):
>
> 50$

64 bucks with shipping, so still a bit more than adding an SSD and SATA-to-USB cable.  
But, not a bad price for a NUC, considering I’ve seen them listed for _much_ more than 50 bucks!  
(not to mention more computational “horsepower” than a RasPi as well)

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [21 August 2019 09:18 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/17 "2019-08-21T09:18:01Z")

</div>

> [@thierry](#):
>
> If I change the value to 10s I still get data in Emoncms every 30s

In the inputs page?

Or the Feeds page?

> [@thierry](#):
>
> Data is sent from an arduino with a emontx shield running a serial\_direct sketch . Arduino is connected to PC via USB.

Ok great.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [21 August 2019 11:28 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/18 "2019-08-21T11:28:32Z")

</div>

> [@thierry](#):
>
> > [@pb66](#):
> >
> > The 30s sendinterval can be defined in the interfacer runtimesettings
> 
> I have tried already, but it does not work ???

Ahh! The penny just dropped, that should be `interval = 10` not “sendinterval”. This has come up before, there is some confusion around that setting as it was originally “interval” but got changed at some point to sendinterval in the emon-pi variant, and then back again at a later date. The file I looked at on GitHub is a “default” conf that hasn’t been corrected, the actual conf file is correct

> <https://github.com/openenergymonitor/emonhub/blob/v2.1.2/conf/emonhub.conf#L77>

---

<div class="post-metadata">

**Author:** ![thierry](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@thierry](https://community.openenergymonitor.org/u/thierry)\
**Post date:** [21 August 2019 12:50 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/19 "2019-08-21T12:50:45Z")

</div>

> [@pb66](#):
>
> Ahh! The penny just dropped, that should be `interval = 10` not “sendinterval”.

It works !!! thanks a lot 👍👍👍

One last question: my emonhub.conf file is in /etc/emonhub  
however the emonhub module is looking for it in /home/pi/data  
therefore I cannot modify the emonhub.conf file directly in the web interface by clicking the “edit config” button.  
How can I explain to the emonhub module editor that it should be looking for the file in /etc/emonhub ?

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [21 August 2019 13:12 UTC](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527/20 "2019-08-21T13:12:28Z")

</div>

> [@thierry](#):
>
> How can I explain to the emonhub module editor that it should be looking for the file in /etc/emonhub ?

Good question, however the emoncms/config module is hardcoded to `/home/pi/data`

> <https://github.com/emoncms/config/blob/f5de426f52d793ff417fdbe585ca9a85d9818e76/config_model.php#L17>

So you can either edit the php code directly, but that will block you from pulling in future updates without saving/losing those changes and reapplying them afterwards. Or you can just accommodate the hardcoded path by creating a symlink at `/home/pi/data/emonhub.conf` pointing to `/etc/emonhub/emonhub.conf` so that the config module can find the same conf file at the path it expects.

These are the sort of things i hope get resolved with the new installer. But by rights as I keep saying time and time again. If they had hardcoded a path to /etc/emonhub and then when the file is located elsewhere (eg /home/pi/data on emonSD) add a symlink to that other place. that would mean the conf file is always found in `/etc/emonhub` on all setups regardless of where it actually is…

[edit] Or I suppose you could actually move the emonhub.conf to the `/home/pi/data` path but that just seems odd! Having a symlink at that path when you have no user pi, is reasonably obvious it is a “workaround” whilst having the conf file on that path just isn’t right in my mind.

[Next page](https://community.openenergymonitor.org/t/installing-emonhub-on-a-pc/11527.md?page=2)
