Skip to main content

API Write

The ADA P1 Meter not only provides data but is also capable of receiving data from external systems. These incoming values are automatically included in the JSON output and, if MQTT is enabled, are also added to the published messages.

This feature enables various custom integrations and automation solutions.

Endpoint

Data can be sent using a POST request to the following URL:

http://okosvillanyora.local:8989/write

Data Format

The POST request must contain JSON-formatted data. The server expects the following fields:

  • plugins: the name or ID of the device
  • values: an array of objects, where each object includes:
    • index: a numeric unique identifier
    • name: a label (e.g., "L1")
    • value: the numerical value
    • unit: the unit of measurement (e.g., "kWh")

Example Using CURL on Windows

curl -X POST "http://okosvillanyora.local:8989/write" ^
-H "Content-Type: application/json" ^
-d "{\"device\":\"Device1\",\"values\":[{\"index\":0,\"name\":\"L1\",\"value\":3.5,\"unit\":\"kWh\"},{\"index\":1,\"name\":\"L2\",\"value\":5.3,\"unit\":\"kWh\"}]}"

Response:

{"status":"success","message":"Data written successfully"}

Result in JSON Output

After a successful write, the JSON output will include a new key: plugins, which contains the submitted values.

"plugins": {
"L1": {
"value": "3.50",
"unit": "kWh",
"timestamp": "74437"
},
"L2": {
"value": "5.30",
"unit": "kWh",
"timestamp": "74437"
}
}

The timestamp is automatically generated based on the device’s current system time.

Use Cases

  • Appending data from your own devices (e.g., thermometers, weather sensors) to the electricity meter data
  • Supplemental measurements (e.g., room-level consumption, external power readings)
  • Manual user input (test values, manual overrides)
  • Logging control signals from automated systems
  • Forwarding to an MQTT broker for analysis or storage

With this feature, the ADA P1 Meter is not just a data reader, but also acts as a data input hub, making your energy monitoring system more flexible and scalable.