API Interface for devices

API description for accessing meters

Using the API interface, you can send a request directly to the meter and get all the current data or manage the external load relay.
To use the API, your application or website needs to send a corresponding HTTP request to the device. Requests can be sent using the GET method. In response to the request, the meter returns an HTTP message containing the result of the processing in its body. The results returned by the device are in JSON format.

For devices of standard versions, requests can be sent no more than once per minute.
For devices with extended versions, queries can be sent every 6 seconds.


Request format for receiving all data from the device
GET ?page=getdata&devid=[Device ID]&devpass=[PIN password]

Additionally, you can add an external load relay control command: pout

0 - turn-on / 1 - turn-off

GET ?page=getdata&devid=[Device ID]&devpass=[PIN password]&pout=0

Sample GET Request.
http://192.168.4.1?page=getdata&devid=1728053249&devpass=012345
Example response from the counter in JSON format (from the 3-phase counter of the extended version).
HTTP/1.0 200 OK
Server: smart-MAC
Content-Type:application/json; charset=utf-8
Connection: close
 
 
{"devid":"1728053249","time":"1530607456","pout":"0","data":{"V1":{"name":"Voltage 1","unit":"V","value":"220.89"},"A1":{"name":"Current 1","unit":"A","value":"2.78"},"W1":{"name":"Active Power 1","unit":"W","value":"586"},"rW1":{"name":"Rev. Active Power 1","unit":"W","value":"0"},"Wh1":{"name":"Energy 1","unit":"Wh","value":"33549075"},"rWh1":{"name":"Rev. Energy 1","unit":"Wh","value":"0"},"PF1":{"name":"Power Factor 1","unit":"","value":"0.94"},"br0":{"name":"
"},"V2":{"name":"Voltage 2","unit":"V","value":"213.40"},"A2":{"name":"Current 2","unit":"A","value":"0.34"},"W2":{"name":"Active Power 2","unit":"W","value":"30"},"rW2":{"name":"Rev. Active Power 2","unit":"W","value":"0"},"Wh2":{"name":"Energy 2","unit":"Wh","value":"4831905"},"rWh2":{"name":"Rev. Energy 2","unit":"Wh","value":"0"},"PF2":{"name":"Power Factor 2","unit":"","value":"0.42"},"br1":{"name":"
"},"V3":{"name":"Voltage 3","unit":"V","value":"218.59"},"A3":{"name":"Current 3","unit":"A","value":"0.28"},"W3":{"name":"Active Power 3","unit":"W","value":"37"},"rW3":{"name":"Rev. Active Power 3","unit":"W","value":"0"},"Wh3":{"name":"Energy 3","unit":"Wh","value":"6710742"},"rWh3":{"name":"Rev. Energy 3","unit":"Wh","value":"0"},"PF3":{"name":"Power Factor 3","unit":"","value":"0.60"},"br2":{"name":"
"},"T":{"name":"Temperature","unit":"°C","value":"14"}}}

JSON parsing, with comments:
{
    "devid": "1728053249",                // Device ID
    "time": "1530607516",                 // Time in UNIX format
    "pout": "0",                          // relay status 0-Off / 1-On
    "data": {
        "V1": {                           // Line 1 Voltage
            "name": "Voltage 1",          // Description
            "unit": "V",                  // Symbol
            "value": "220.64"             // Value
        },
        "A1": {                           // Line 1 Current
            "name": "Current 1",
            "unit": "A",
            "value": "2.76"
        },
        "W1": {                           // Line 1 Active power consumption
            "name": "Active Power 1",
            "unit": "W",
            "value": "581"
        },
        "rW1": {                           // Active reverse power (for example, Solar Cells)
            "name": "Rev. Active Power 1",
            "unit": "W",
            "value": "0"
        },
        "Wh1": {                           // Energy, cumulative consumption
            "name": "Energy 1",
            "unit": "Wh",
            "value": "33549084"
        },
        "rWh1": {                          // Reverse Energy, cumulative consumption
            "name": "Rev. Energy 1",
            "unit": "Wh",
            "value": "0"
        },
        "PF1": {                           // Power Factor ( cos ф )
            "name": "Power Factor 1",
            "unit": "",
            "value": "0.94"
        },
        "br0": {                           // service information
            "name": "
"
        },
        "V2": {                            // similar to the above for the 2nd line
            "name": "Voltage 2",
            "unit": "V",
            "value": "217.53"
        },
        "A2": {
            "name": "Current 2",
            "unit": "A",
            "value": "0.33"
        },
        "W2": {
            "name": "Active Power 2",
            "unit": "W",
            "value": "31"
        },
        "rW2": {
            "name": "Rev. Active Power 2",
            "unit": "W",
            "value": "0"
        },
        "Wh2": {
            "name": "Energy 2",
            "unit": "Wh",
            "value": "4831906"
        },
        "rWh2": {
            "name": "Rev. Energy 2",
            "unit": "Wh",
            "value": "0"
        },
        "PF2": {
            "name": "Power Factor 2",
            "unit": "",
            "value": "0.44"
        },
        "br1": {
            "name": "
"
        },
        "V3": {                            // similar to the above for the 3rd line
            "name": "Voltage 3",
            "unit": "V",
            "value": "216.34"
        },
        "A3": {
            "name": "Current 3",
            "unit": "A",
            "value": "0.28"
        },
        "W3": {
            "name": "Active Power 3",
            "unit": "W",
            "value": "36"
        },
        "rW3": {
            "name": "Rev. Active Power 3",
            "unit": "W",
            "value": "0"
        },
        "Wh3": {
            "name": "Energy 3",
            "unit": "Wh",
            "value": "6710743"
        },
        "rWh3": {
            "name": "Rev. Energy 3",
            "unit": "Wh",
            "value": "0"
        },
        "PF3": {
            "name": "Power Factor 3",
            "unit": "",
            "value": "0.60"
        },
        "br2": {
            "name": "
"
        },
        "T": {                            // temperature inside the device
            "name": "Temperature",
            "unit": "°C",
            "value": "14"
        }
    }
}

Successes in development!

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