How to collect data every 5 seconds

Data on the cloud server is saved once a minute, which is more than enough for a detailed analysis of the quality of the electrical network and energy consumption. But we should understand that measurements take place at some point in time within a minute and if, for example, there was an extremum lasting 20 seconds, then it may not be visible on the chart.

What if you need to get more detailed data?

The Extended versions of smart-MAIC Devices allow receiving data via MQTT protocol every 5 seconds and sending an API request to the device every 5 seconds. We do not pretend to be a network analyzer, but analysis of 5-second intervals will already allow us to find peak loads with a high degree of probability.

MQTT Client

To send data every 5 seconds via the MQTT protocol, just open the device settings and in the MQTT Config section set the desired data sending interval, at least 5 seconds.

Image 929

API Requests

To receive data via the API interface, no additional settings are required, you simply send a GET request to the device every 5 seconds and receive the current data in response.
How to work with API for devices, see the corresponding article in the Knowledge Base »

For example, you can write a simple script for EXCEL that will send a GET request over the local network at an interval to the smart-MAC energy monitor and fill the table with the received data.

This EXCEL file can be downloaded from the link below.

  • API for single phase Energy Monitor smart-MAIC D101 Download »
  • API for three-phase Energy Monitor smart-MAIC D103 Download »
  • API for universal pulse counter smart-MAIC D105 Download »

How to use the device API file.

The first time you run the EXCEL file:

- confirm the ability to execute scripts, click "Enable Content"

Image 930

- open the "Developer" tab

To display the Developer tab, if it is not there, on the File select Options -> Customize Ribbon.
Under Customize Ribbon in the Main Tabs list, select the Developer check box.

- on the "Developer" tab click the "Visual Basic" button

Image 928

- open menu Tools -> References and include libraries Microsoft Internet Controls, Microsoft Scripting Runtime и Microsoft WinHTTP Services

Image 1927

Also check that all included modules match your version of EXCEL.
Check all libraries that reference the path "...\Microsoft Office\Office15\..."
If you have a different version of EXCEL, click the Browse button and find the libraries on disk.
For example, if you have version 14, then try searching in the folder "...\Microsoft Office\Office14\..."


- click Ok, close VBA and reopen the file.

Fill in the cells with settings for your device:

Image 927

IP Address - IP address of the power monitor in the local network.
To search for a device on the network, you can use the MACFinder utility for Windows platforms Download »

Device ID - 10-digit device ID

Password - password on the device
Duration - duration of data collection in minutes, maximum 1440 minutes, this is a day
Interval - request interval in seconds, minimum 5 seconds, maximum 3600 seconds

GMT - your Time Zone
Press the START button and watch the table fill with data.

Done, data for detailed analysis received!

This article was helpful for 25 people. Is this article helpful for you?