ESPproMon Integration


#1

When we designed the ESPproMon app it was on the basis that it would allow easy integration with other systems.This integration involves sending or receiving information from other iOT networks such as Thingspeak and EmonCMS etc.

Our public dashboard for data that we send to EmonCMS is available here and if you click the link it will bring up a dynamic web page like the image below.


If you keep the page open you will see live data from our Peacefair Pzem-004T updating the gauges towards the left side of the page. The graph shows a snapshot of our data from 17:30 to 22:00 last night. It’s not the clearest of graphs as we are plotting all the available parameters from ESPproMon in a single chart but if you click the legend for any of the 6 parameters it will remove them from view and make the graph much clearer.

The fairly similar spikes across the graph are for our air con unit kicking in and the biggest spike at 18:30 highlights when we made a cup of tea. Feel free to play around with the graph as it’s only a visual representation and will not affect our actual data.

In a future post we will provide details of how you create the data feeds in EmonCMS but the rest of this topic will cover entering the API key in ESPproMon and output from the EmonCMS server. The image below shows the simple process of entering your EmonCMS API key in the ESPproMon app. The Terminal on the TARIFF page reminds you every few minutes if you haven’t added your API key in our app (blue highlighting) and you can simply ignore this reminder if you are not using EmonCMS.


As shown with the red highlighting you simply select parameter 17 and then enter your API key. Terminal will confirm it has now stored your key. We recommend you email the key to yourself and then cut and paste it into the Terminal to prevent mistyping of the key.

EmonCMS can be set up to email you once a week with a clear report of the electricity you have used each day. The image below was simulated data ESPproMon sent to the EmonCMS server a few months ago. We will add our live data in a followup post

EmonCMS also has it’s own smartphone app and this is our data for the last 18 hours.

Configuring EmonCMS does take a little work and needs to be done in a specific way for it to accept data from our ESPproMon app. We will cover this and other iOT networks in follow up posts.


Peacefair Pzem-004T with EmonCMS Integration Weekly Data to 18 Feb 2018
#2

The image below is a live data feed from our Peacefair Pzem-004T to Thingspeak via the ESPproMon smartphone app.


Thingspeak is much easier to set up than EmonCMS but Thingspeak doesn’t have some of the features offered by EmonCMS.
Our public channel on Thingspeak is https://thingspeak.com/channels/418060 but the Watts is now simulated data from an ESP running ESPproMon without a Pzem module attached. The image was live data but at present the app is set to send data to EmonCMS or Thingspeak, not both at the same time. As we prefer the extra features provided by EmonCMS we have set our live data to go to that network.

In Thingspeak you need to set Field 2 for the Power field and if you want the RSSI the app uses Field 1.

If you select parameter 24 Check Firmware on the TARIFF page of the app it will download the latest ESP firmware from our server and you should then have an extra parameter 36 Enter API key. If you select this new parameter Terminal will prompt you to enter the API key for your Thingspeak channel. If you have your Pzem wired up it will send live data at 15.2 second intervals. If you don’t have the Pzem wired up just select Demo ON from the SETUP page and it will start updating the channel with simulated data. The RSSI data is actual not simulated.


How do I integrate with thingspeak
#3

Когда мы разработали приложение ESPproMon, оно было основано на том, что оно позволило бы ** легко интегрировать ** с другими системами. Эта интеграция включает в себя отправку или получение информации из других сетей iOT, таких как ** Thingspeak ** и ** EmonCMS ** и т. Д. ,

Наша общедоступная панель мониторинга для данных, которые мы отправляем в EmonCMS, доступна [здесь] (https://emoncms.org/dashboard/view?id=47622), и если вы нажмете ссылку, она откроет ** динамическую веб-страницу ** как изображение ниже.


Если вы оставите страницу открытой, вы увидите ** текущие данные ** из нашего ** Peacefair Pzem-004T **, обновляя датчики в левой части страницы. График показывает ** моментальный снимок ** наших данных с 17:30 до 22:00 прошлой ночью. Это не самый ясный график, поскольку мы рисуем все доступные параметры из ESPproMon в одном графике, но если вы нажмете легенду для любого из 6 параметров, она удалит их из представления и сделает график более понятным.

Довольно похожие всплески по графику для нашего подразделения воздушного охлаждения, и самый большой всплеск в 18:30, когда мы сделали чашку чая. Не стесняйтесь играть с графиком, поскольку это только визуальное представление и не повлияет на наши фактические данные.

В следующем посте мы расскажем о том, как вы ** создаете каналы данных ** в EmonCMS, но в остальной части этого раздела будет рассмотрен ввод ключа API в ESPproMon и вывод с сервера EmonCMS. На приведенном ниже рисунке показан простой процесс ввода вашего ключа API EmonCMS в приложении ESPproMon. Терминал на странице TARIFF ** напоминает вам ** каждые несколько минут, если вы еще не добавили ключ API в наше приложение (синяя подсветка), и вы можете просто проигнорировать это напоминание, если вы не используете EmonCMS.


Как показано красной подсветкой, вы просто выбираете параметр 17, а затем вводите свой ключ API. Терминал подтвердит, что он сохранил ваш ключ. Мы рекомендуем вам ** отправить по электронной почте ключ к себе **, а затем вырезать и вставить его в терминал, чтобы предотвратить неправильное нажатие клавиши.

EmonCMS можно настроить для отправки по электронной почте один раз в неделю с четким отчетом о потреблении электроэнергии, которую вы использовали каждый день. На изображении ниже были смоделированы данные ESPproMon, отправленные на сервер EmonCMS несколько месяцев назад. Мы добавим данные в реальном времени в следующую запись

У EmonCMS также есть собственное приложение для смартфонов, и это наши данные за последние 18 часов.

Конфигурирование EmonCMS делает небольшую работу и должно выполняться ** определенным образом ** для принятия данных из нашего приложения ESPproMon. Мы рассмотрим эту и другие сети iOT в последующих сообщениях.


#4

下面的圖片是通過ESPproMon智能手機應用程序從我們的** Peacefair Pzem-004T Thingspeak 的實時數據饋送。


事情說起來比EmonCMS容易得多,但Thingspeak沒有EmonCMS提供的一些功能。
我們在Thingspeak上的
公共頻道是 https://thingspeak.com/channels/418060 ,但是瓦特現在是ESP運行的ESP的模擬數據,沒有附加一個Pzem模塊。該圖像是實時數據,但目前該應用程序設置為發送數據到EmonCMS 的事情,而不是在同一時間。由於我們更喜歡EmonCMS提供的額外功能,我們已經設置了我們的實時數據去到那個網絡。

在Thingspeak中,您需要為Power字段設置字段2,如果您想要RSSI,則應用程序使用字段1。

如果您在應用程序的TARIFF頁面選擇參數** 24檢查固件**,它將從我們的服務器下載最新的ESP固件,然後您應該有一個額外的參數** 36輸入API密鑰**。如果你選擇這個新的參數,終端會提示你輸入你的Thingspeak頻道的API密鑰。如果您的Pzem已經連線,它將以15.2秒的間隔發送實時數據。如果您沒有連接Pzem,只需從SETUP頁面選擇Demo ON,它將開始用模擬數據更新頻道。 RSSI數據實際上不是模擬的。


#5

I was going to write this in “Japanese” or “Chinese” for our users in Japan and China but I think I’ll stick to English. Click the globe icon below this post if your computer is not using English and hopefully it will translate it for you.


Once you ahve everything running in ESPproMon and you want to start the integration with EmonCMS.org log into your EmonCMS.org account and create the following inputs with the exact same Key names as highlighted in yellow. You can use any description in any language but the keys must be RP1, P1, C1, T1, PF1, V1 and E1.
The process list will create each one as log and you need to add kwh for RP1 (real power).

You will then need to add each of the inputs in the feed section of EmonCMS and set them to receive updates at 15 second intervals. You should also create an additional feed item for accumulated KWH.

Any questions let us know and we will add details of how you get the weekly energy usage email from EmonCMS in a follow up post.


Connecting a PeaceFair Pzem-004T to an Espressif ESP8266
Connecting a PeaceFair Pzem-004T to an Espressif ESP8266
#6

@Tony @Tokn59 do you have your EmonCMS inputs and feeds set up as shown in the post above?

if we run into dificulties I might ask you to PM your EmonCMS login credentials and I will tweak your account. If we go down that route you can change you password later and I will make notes of the mods I do so they can benefit other users etc.


#7

I started doing this at some point but did not complete it with all inputs. Now I have no clue where/how I can add additional/missing inputs ?


#8

@Tokn59 OK send me your EmonCMS credentials via PM and if you use a generic password for multiple sites change the password before you send me the details.

It’s easier for me to make notes of the mods than try to remember the precise process from memory.


#9

Received your credentials, thanks.


#10

@Tokn59 actually I need your username not the email address. Please send via PM.


#11

@Tokn59 been working on your account and some of it was easier than I remember.

The API uses the following format including sample data:
https://emoncms.org/input/post?node=1&fulljson={"P1":896.19,"RP1":663.18,"E1":10233.48,"PF1":0.74,"V1":242.9,"C1":3.69,"T1":26.1}&apikey=xxxx

I deleted all the inputs and feeds from your account and if you enter that url in a web browser with your read-write API key it automatically populates the EmonCMS database with this:

You don’t need to use a browser as the app will do it for you but it’s useful to test it in a browser first as there are some edits required once the database has been populated.

I will continue editing the Inputs and setting up the feeds and then I will post further details.


#12

Set up a process list for each of the 7 inputs by clicking the spanner icon and this will create 7 feeds.


The area marked in red in the image is where you overwrite the default description with whatever you want to use e.g. Current , Temperature etc and they can be in any language as the app only uses the Key names.
Leave all process details as default i.e. 10s intervals (which are actually 15s in the app) and click add.
When all 7 log to feed processes are added it will look like this:

As shown in red in the image above it indicates that the names that we allocated for each feed are not shown in the description field but if you switch from inputs to feeds (by selecting the spanner at the top right of the screen) you will see this image.

I have made all the feeds publicly accessible by clicking on the globe image against each feed. if you want them to be private just click the globe again (default is private but I like mine to be available to the public).
Now let’s go back to the 7 inputs as we have a few mods to do including adding the descriptions as they are currently only shown in the feeds page. Actually adding the descriptions is a little difficult in the input screen as it keeps refreshing the page at 10s intervals so you have to be quick when typing each description. The description field is accessed by clicking the pen icon against each input. You should now have something like this.

The only other thing left to do in this section is to get the Real Power to keep a sum of the total energy used. The Peacefair Pzem actually already has this data and its input E1 Energy WH. Our app is not just for the Pzem though so we also create a cumulative energy used to date for use by the EmonCMS database. Select the Real Power input and click the spanner at the end of the row.

Select the Power to Kwh process from the drop down list, over type Real Power with KWH and leave all the other settings as default and click add.
Few more details to follow in the next post.


#13

What we have done so far for EmonCMS might look like a lot of work with all the screenshots but once you know what you are doing it only takes a few minutes to get to this stage.

You will now have 7 inputs and 8 feeds as the real power input generates 2 feeds (real power now and cumulative real power). The cumulative real power can be different to the cumulative data from the Pzem as it’s normal to reset the cumulative on the Pzem when you receive each of your energy bills whereas the EmonCMS record will just keep rolling on.

@Tokn59 I have added your API key to your account on our cloud server to save you having to enter it via the app but also for me to check all is working OK.
You should recognise the data below as your live feed as it is now.


In theory the data should never be more than about 15s old but sometimes the EmonCMS server does get a backlog of data to process but it normally catches up over time.

You can add the EmonCMS app to your smartphone now and login with the credentials you gave me to see your data. I use the app on Android but I have checked and it’s also available for iOS.

I’m going to leave it there for now but there are 2 things left to cover.

  1. The process of requesting a weekly summary of your energy usage.

  2. Creating the EmonCMS dashboard with interactive charts and other widgets.

I’m going to let users create their own dashboards but you can see ours online and covered earlier in this thread to get an idea of what it possible.

Will document 1. above as soon as possible.

If anyone has any questions regarding EmonCMS please ask away.


#14

@Tokn59 your public dashboard is set up at https://emoncms.org/dashboard/view&id=47845

I have only added a gauge to show Amps and will leave it to you to add other widgets to the dashboard.

The weekly email report is accessed by clicking Extras and then Email Reports towards the top right.
As you will see in the screenshot below you can disable it at anytime. I have added your live address and you should have received a test report.

The emails are sent out by EmonCMS every Monday morning.


#15

Yes ! I did receive the email ! Great ! Thank you so much ! Will have a good look at everything ASAP and let you know !

Big thanks !!!


#16

@Tokn59 sent you a message about setting your local timezone in the app and added it to our quick start guide at Smart Meter Quick Start Guide

I looked at your dashboard and I see the text of “26.9 Kwh today” but I’m thinking this is the cumulative KWH for the Pzem not today’s usage.


#17

As some of you will be aware Open Energy Monitor (OEM) in Wales are going to start charging for data stored on their EmonCMS.org server from 1st July 2018.

There is a thread on their Community site which provides details of how the fees will be charged including rebates for anyone that has bought hardware from them in recent years.

The cost is very reasonable at £1 per feed per year. I am using 8 feeds so £8 per year wouldn’t be a problem for me. However in some parts of the world, and where users have lots of Pzem’s wired up the cost could mount up.

OEM are quite happy for individuals to use EmonCMS server on a local machine. This will require a firmware modification which we have started working on.

Meanwhile here are a couple of guides on setting up a local EmonCMS server on a $10 Raspberry Pi and copying the data across from the EmonCMS.org server.

I was originally have a problem backing up the remote server but as per this post I have it running OK now.

Even if you don’t plan to run a local EmonCMS server it might be worth at least backing up your EmonCMS.org data from time to time.

I will post here if I get the firmware mods to update my local EmonCMS server.


#18

One of my Pzem’s is now updating my local EmonCMS server on the Raspberry Pi W.

Once we have completed the testing we will look to do an automatic OTA update of the firmware.

In the meantime if you restart the app (Android or iOS) you should notice that the parameter settings in the TARIFF page has a few minor amendments. Parameter 37 is for you to enter the URL of your local server.

The URL needs to exclude the initial h (of https://) and will normally end as /emoncms/

Once you have set the URL you need to enter your WRITE API key with parameter 17. To distinguish between a local EmonCMS server and EmonCMS.org the key has to be entered in a particular way.

Local server: key=the32digitcode
EmonCMS.org: the32digitcode

The ESPproMon system should then start updating your local server.

If anyone wants to test the new firmware before it is officially released please let me know.


#19

I would like to test it please. :slight_smile:
I tried it so long but when I select option “37 Local EmonCMS URL”, it does not ask me in the terminal to add it and it did not confirm that I entered anything. Thank you for all your hard work on this Paul. You are doing a great job!


#20

We have now uploaded the new firmware to the server. As long as your ESP8266 is powered up at midnight it should automatically upgrade the firmware to include the local EmonCMS server functionality.

If you haven’t restarted the app in the last 24 hours you should do that now.

If you want to force the firmware update before midnight follow these steps:

  1. On the DATA page check that it shows NEXT VERSION as V00223.
    2.On the TARIFF page select parameter 24 Check Firmware

If your ESP8266 accepts the request it will display a message in the green terminal window that begins “System will reboot and update …”. If you don’t see this message keep requesting parameter 24 until you do.

Once the firmware has updated it will show NEXT VERSION has V00224 in the DATA page.