MEW-01 energy monitor — downloading the electricity usage history from the server to Excel – part 2

Learn how to pull the last 5,000 electricity usage records from the MEW-01 device out of the Supla server and into MS Excel with the REST API.

I work at ZAMEL. The devices described on this blog were made available to me by the company. All opinions and ratings are my own - the company had no influence on the content of the published articles.

In the first part of the article I showed how to download the most recent parameters of the electrical grid using MS Excel. The Supla server can do a bit more, though. We can also download our usage history from the MEW-01 device by ZAMEL.

With REST API queries we can download up to the last 5,000 records. In this part of the post I want to show how to do it.

Let’s get started.

1. We open MS Excel.

The Excel window

2. We log in to our Supla account: cloud.supla.org.

3. Once logged in to our Supla account, we go to the Integrations tab:

Supla integrations

4. Then, in the Integrations tab, we choose Personal access tokens and generate our token:

Creating a new token in a Supla account

5. We generate a personal access token with permission to read channels:

Creating a new token in a Supla account

6. After choosing Generate token our code should appear, and we save it in a safe place:

Supla token

7. In the API documentation tab we can find the command that reads the electricity usage data from our MEW-01 device:

Supla API

8. We open that tab**.** The full documentation appears, where we can see the whole library of queries we can send to the SUPLA server. First of all I suggest testing our personal access token. To do that we click the Authorize button:

Getting Supla data through the API

9. We paste our token into the BearerAuth (http, Bearer) field and click Authorize:

Getting Supla data through the API

10. After logging in correctly we will see a window that we can already close:

Getting Supla data through the API

11. In the API query library we can go to the command:

GET​/channels​/{id}​/measurement-logsGet measurement logs.

Getting data from the MEW-01 through the API

As you can see, we will need the ID number of our MEW-01 device. We take it from the My Supla tab, opening the details of the MEW-01 device. In my case it is: 12792

MEW-01 settings in a SUPLA account

We fill in the data as in the picture below. For the test we pull only 1 entry, and we set that number in the limit field. At the end we click the Execute button.

Getting data from the MEW-01 through the API

12. After running the query correctly we should get a result:

Data downloaded from the MEW-01 device through the API

13. Now it is time to use this data in MS Excel. We will need the data from the window. I suggest saving it in a notepad:

Data downloaded from the MEW-01 device through the API

14. In Excel we go to the Data tab and choose From Web. In this window we are interested in the Advanced queries:

Getting data from the MEW-01 through the API into Excel

15. We fill in the fields following the pattern of the information we saved earlier:

In the URL part I set the limit to the highest value we can download, that is 5,000. It means we will download 5,000 entries:
https://svr9.supla.org/api/v2.3.0/channels/12792/measurement-logs?limit=**5000**

In the HTTP request header parameters (optional):
Accept application/json
Authorization Bearer NGU5OGI3MDkwNzk4NTlmMjY3YmRhZTE3NWM5NTBjMzQ0MmM3MjM3NDA4YjQ2YTQ0ZjVlNjAwY2YxMzA5NDcyOQ.aHR0cHM6Ly9zdnI5LnN1cGxhLm9yZw==

Getting data from the MEW-01 through the API into Excel

16. In the next step we can download the data into Excel by clicking OK. We should now see all the downloaded records in the List Tools window:

The macro tools window

17. Ok, so how do we get this data into our Excel sheet? Here is the answer. We right-click the list of records and choose To Table:

Getting data from the MEW-01 into Excel

Then, in the next window, we choose OK:

Getting data from the MEW-01 into Excel

Our list has been converted into a table. Now we only need to expand the column to see all the results:

Record tools for the MEW-01 Data downloaded from the MEW-01 into Excel MEW-01 data in Excel

18. In the next step we change the data type of each column to a decimal number and rework our table. I used a simple conversion for the time; remember that you may still need to adjust it to the time zones. I will also add a few custom columns with the right functions, so that the data is easy to read:

MEW-01 usage history in Excel Formatting the MEW-01 usage data in Excel Setting up the data download from the MEW-01 into Excel MEW-01 usage data downloaded into Excel

19. That is all. You now know how to download the measurement history.


Try my online measurement analyser too. It loads a CSV file with the measurement history of an energy monitor (MEW-01/MEW-02 from Supla Cloud) and shows usage in the ranges you pick, the hourly profile and a comparison of the G11 and G12 tariffs — everything is calculated locally in your browser, with no data sent anywhere. This is a beta version, so give it a try: Energy monitor measurement analyser.

Smart home, or a smaller electricity bill?

Smart home installations, energy monitoring and consulting run under the TECH.WILDE brand.