Getting started ESP8266 (MQTT?) + EmonCMS

Hi! I am all new to this so please have my low knowledge excused :smile:

I want to be able to monitor some of the main power users in my house and garage (2 electric car chargers, 2 heat pumps / air conditioners, hot water and so on).

I therefore purchased some CT sensors and planned to make something using Arduinos or RasberryPis. But then I found a 4 channel CT sensor card which supported Wemos D1 mini (ESP8266) and bought two of those. (4 Channel ESP8266 Mains Current Sensor - Wemos - Current - SCT013 - 100A/50mA | eBay)

My plan was then to make a custom web app from scratch on my own server but then I discovered OpenEnergyMonitor and EmonCMS.

I have spent some time trying to read docs and looking at schematics and looking at firmware, but I cannot get my head around how to set this up, so I need a hand :slight_smile:

I have installed EmonCMS on my home server using the Docker image and EmonCMS is up and running fine. Now, how should I continue to put some data? The sensor card + Wemos D1 has some firmware which supports MQTT. I can maybe use this as a start?

Is what I am trying to achieve possible?

Hello @buestad and welcome! The standard emoncms docker image does not support MQTT. I would suggest if you can using our pre-built emoncms image installed on a RaspberryPi, this has the full emoncms stack including MQTT and should be easier for you to work with. You can download the image here: https://github.com/openenergymonitor/emonpi/wiki/emonSD-pre-built-SD-card-Download-&-Change-Log

Once you have that you can publish to the MQTT server running on the Pi, the credentials are listed here:
Service Credentials - Guide | OpenEnergyMonitor

If not sure what structure the MQTT messages are sent as from the Wemos D1 mini. Emoncms is expecting data in the following format:

emon/nodename/inputname value

e.g:

emon/mynode/power1 123.0

EmonCMS will also accept valid JSON as the MQTT Payload to a topic such as emon/nodename.

{"name": value, "name2": value}

If you have a lot of data, this is a better format as it is a single ‘read’ from the MQTT broker.

Thanks for the hints. However I have chosen an other solution using a MySQL database and Grafana.

Are you running your database on a Raspberry Pi?

If so, you’ll find that as your database grows, the response time to view a graph that displays more than a few months of data will increase. As data accumulates, the delay in displaying the graph
grows from well under a second, to several seconds.

That was the main reason the authors of emonCMS moved away from MySQL.