FlatPeak supports both device-level and location-level metering and energy cost calculation. You can send meter records from your device or property meter to FlatPeak API and get the cost of that energy back in real-time or aggregated by (usage) session, day, month or a year.

Device level

Before you begin, you need to obtain a FlatPeak identifier for your device. Follow the creating device identifiers article to learn how to do this. Once you have the FlatPeak device identifier, the device_id, you can get its energy cost calculated in two ways:

Use instant-cost-calculate endpoint to submit metering records and instantly get the cost of that energy. Your API request will look similar to the example below. The response will include your original request and monetary energy cost in the tariff object:

curl --request POST \
  --url https://api.flatpeak.com/costs/instant \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start_time": "2022-02-01T10:30:00Z",
  "end_time": "2022-02-01T11:00:00Z",
  "location_id": "loc_641b90b758fb8e6293716e40",
  "device_id": "dev_65e6d8334c8d715963d99db3",
  "direction": "IMPORT",
  "tariff_rate": "IMPORT",
  "units": "W",
  "value": 20567
}'

Location level

FlatPeak also supports location-level energy cost reporting. You can submit meter readings from the property, and FlatPeak will compute the energy cost using the tariff associated with that location. Use the same flow for device-level, but only provide the location_id.

Simulating energy usage profiles

If you need to model energy usage (and/or export) scenarios, pass non_persistent with your request to instant-cost-calculate endpoint. This will enable you to estimate energy cost without affecting actual consumption data.