Energy Saving Performance API Module
The Energy Saving Performance API provides comprehensive energy-saving project evaluation functionality, helping enterprises quantify the actual effects of energy-saving measures, calculate return on investment (ROI), and generate energy-saving verification reports that comply with international standards.
Calculates the actual performance of energy-saving measures, including energy savings, cost savings, and return on investment.
Request Parameters
{
"project_id": "string, required, energy-saving project ID",
"baseline_data": {
"start_date": "YYYY-MM-DD, required, baseline period start date",
"end_date": "YYYY-MM-DD, required, baseline period end date",
"energy_usage": "number, required, baseline period energy usage",
"unit": "string, required, energy unit"
},
"reporting_data": {
"start_date": "YYYY-MM-DD, required, reporting period start date",
"end_date": "YYYY-MM-DD, required, reporting period end date",
"energy_usage": "number, required, reporting period energy usage",
"unit": "string, required, energy unit"
},
"cost_data": {
"project_cost": "number, optional, total project cost",
"currency": "string, optional, currency code"
}
}
Response Example
{
"status": "success",
"data": {
"project_id": "proj_12345",
"savings": {
"energy": 1250,
"unit": "kWh",
"percentage": 15.5,
"cost": 6250,
"currency": "TWD"
},
"performance": {
"actual_vs_expected": 98.2,
"unit": "percent",
"rating": "excellent"
},
"roi": {
"payback_period": 18,
"unit": "months",
"net_present_value": 125000,
"currency": "TWD"
}
}
}
Code Examples
PHP
Python
Java
C#
// PHP Example
$url = 'https://api.faucetsolution.com.tw/v2/energy/performance';
$data = [
'project_id' => 'proj_12345',
'baseline_data' => [
'start_date' => '2023-01-01',
'end_date' => '2023-03-31',
'energy_usage' => 8500,
'unit' => 'kWh'
],
'reporting_data' => [
'start_date' => '2023-04-01',
'end_date' => '2023-06-30',
'energy_usage' => 7200,
'unit' => 'kWh'
]
];
$options = [
'http' => [
'header' => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
# Python Example
import requests
url = "https://api.faucetsolution.com.tw/v2/energy/performance"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"project_id": "proj_12345",
"baseline_data": {
"start_date": "2023-01-01",
"end_date": "2023-03-31",
"energy_usage": 8500,
"unit": "kWh"
},
"reporting_data": {
"start_date": "2023-04-01",
"end_date": "2023-06-30",
"energy_usage": 7200,
"unit": "kWh"
}
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
// Java Example
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
public class EnergyPerformance {
public static void main(String[] args) throws Exception {
String url = "https://api.faucetsolution.com.tw/v2/energy/performance";
String apiKey = "YOUR_API_KEY";
JSONObject data = new JSONObject();
data.put("project_id", "proj_12345");
JSONObject baseline = new JSONObject();
baseline.put("start_date", "2023-01-01");
baseline.put("end_date", "2023-03-31");
baseline.put("energy_usage", 8500);
baseline.put("unit", "kWh");
data.put("baseline_data", baseline);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(data.toString()))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// C# Example
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.faucetsolution.com.tw/v2/energy/performance"),
Headers = {
{ "Authorization", "Bearer YOUR_API_KEY" }
},
Content = new StringContent(
"{\"project_id\":\"proj_12345\"," +
"\"baseline_data\":{" +
"\"start_date\":\"2023-01-01\"," +
"\"end_date\":\"2023-03-31\"," +
"\"energy_usage\":8500," +
"\"unit\":\"kWh\"}," +
"\"reporting_data\":{" +
"\"start_date\":\"2023-04-01\"," +
"\"end_date\":\"2023-06-30\"," +
"\"energy_usage\":7200," +
"\"unit\":\"kWh\"}}",
Encoding.UTF8,
"application/json")
};
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
Upload device energy consumption data, supporting batch upload and multiple data formats.
Request Parameters
{
"device_id": "string, required, device unique identifier",
"readings": [
{
"timestamp": "ISO8601, required, reading time",
"energy_usage": "number, required, energy usage",
"unit": "string, required, energy unit",
"voltage": "number, optional, voltage",
"current": "number, optional, current",
"power_factor": "number, optional, power factor"
}
],
"metadata": {
"location": "string, optional, device location",
"device_type": "string, optional, device type"
}
}
Response Example
{
"status": "success",
"data": {
"device_id": "dev_12345",
"uploaded_records": 24,
"first_timestamp": "2023-01-01T00:00:00Z",
"last_timestamp": "2023-01-01T23:00:00Z",
"total_energy": 1250.5,
"unit": "kWh"
}
}
Code Examples
PHP
Python
Java
C#
// PHP Example
$url = 'https://api.faucetsolution.com.tw/v1/energy/upload';
$data = [
'device_id' => 'dev_12345',
'readings' => [
[
'timestamp' => '2023-01-01T00:00:00Z',
'energy_usage' => 52.3,
'unit' => 'kWh',
'voltage' => 220,
'current' => 5.2
],
[
'timestamp' => '2023-01-01T01:00:00Z',
'energy_usage' => 48.7,
'unit' => 'kWh'
]
]
];
$options = [
'http' => [
'header' => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
# Python Example
import requests
from datetime import datetime, timezone
url = "https://api.faucetsolution.com.tw/v1/energy/upload"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"device_id": "dev_12345",
"readings": [
{
"timestamp": datetime.now(timezone.utc).isoformat(),
"energy_usage": 52.3,
"unit": "kWh"
}
]
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
// Java Example
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
import org.json.JSONArray;
public class EnergyUpload {
public static void main(String[] args) throws Exception {
String url = "https://api.faucetsolution.com.tw/v1/energy/upload";
String apiKey = "YOUR_API_KEY";
JSONObject data = new JSONObject();
data.put("device_id", "dev_12345");
JSONArray readings = new JSONArray();
JSONObject reading1 = new JSONObject();
reading1.put("timestamp", "2023-01-01T00:00:00Z");
reading1.put("energy_usage", 52.3);
reading1.put("unit", "kWh");
readings.put(reading1);
data.put("readings", readings);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(data.toString()))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// C# Example
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.faucetsolution.com.tw/v1/energy/upload"),
Headers = {
{ "Authorization", "Bearer YOUR_API_KEY" }
},
Content = new StringContent(
"{\"device_id\":\"dev_12345\"," +
"\"readings\":[{" +
"\"timestamp\":\"2023-01-01T00:00:00Z\"," +
"\"energy_usage\":52.3," +
"\"unit\":\"kWh\"}]}",
Encoding.UTF8,
"application/json")
};
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
Provides AI-generated energy-saving recommendations based on device historical energy consumption data.
Request Parameters
Parameter
Type
Description
device_id
string
Required, device unique identifier
period
string
Optional, analysis period (7d, 30d, 90d), defaults to 30d
Response Example
{
"status": "success",
"data": {
"device_id": "dev_12345",
"analysis_period": {
"start": "2023-01-01",
"end": "2023-01-31"
},
"average_daily_usage": 45.2,
"unit": "kWh",
"peak_hours": [9, 10, 14, 15],
"recommendations": [
{
"id": "rec_001",
"type": "schedule_adjustment",
"description": "Recommend adjusting device operation time to avoid peak hours (9-11,14-16)",
"estimated_saving": 12.5,
"unit": "percent"
},
{
"id": "rec_002",
"type": "equipment_upgrade",
"description": "Consider upgrading device to energy efficiency class A++ model",
"estimated_saving": 25.0,
"unit": "percent",
"payback_period": 24,
"unit": "months"
}
]
}
}
Code Examples
PHP
Python
Java
C#
// PHP Example
$url = 'https://api.faucetsolution.com.tw/v1/energy/advice?device_id=dev_12345&period=30d';
$options = [
'http' => [
'header' => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
],
'method' => 'GET'
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
# Python Example
import requests
url = "https://api.faucetsolution.com.tw/v1/energy/advice"
params = {
"device_id": "dev_12345",
"period": "30d"
}
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
// Java Example
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class EnergyAdvice {
public static void main(String[] args) throws Exception {
String deviceId = "dev_12345";
String period = "30d";
String url = "https://api.faucetsolution.com.tw/v1/energy/advice?device_id=" +
URLEncoder.encode(deviceId, StandardCharsets.UTF_8) +
"&period=" + URLEncoder.encode(period, StandardCharsets.UTF_8);
String apiKey = "YOUR_API_KEY";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// C# Example
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.faucetsolution.com.tw/v1/energy/advice?device_id=dev_12345&period=30d"),
Headers = {
{ "Authorization", "Bearer YOUR_API_KEY" }
}
};
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
Get energy saving summary for specified period, can return data by day, week, month or year granularity.
Request Parameters
Parameter
Type
Description
start_date
YYYY-MM-DD
Required, start date
end_date
YYYY-MM-DD
Required, end date
granularity
string
Optional, data granularity (day, week, month, year), defaults to day
device_ids
string[]
Optional, device ID list, multiple IDs separated by commas
Response Example
{
"status": "success",
"data": {
"summary": {
"total_energy_usage": 1250.5,
"total_energy_saving": 312.6,
"saving_percentage": 25.0,
"unit": "kWh",
"cost_saving": 1563.0,
"currency": "TWD"
},
"details": [
{
"period": "2023-01-01",
"energy_usage": 52.3,
"energy_saving": 13.1,
"saving_percentage": 25.0,
"cost_saving": 65.5
},
{
"period": "2023-01-02",
"energy_usage": 48.7,
"energy_saving": 12.2,
"saving_percentage": 25.0,
"cost_saving": 61.0
}
]
}
}
Code Examples
PHP
Python
Java
C#
// PHP Example
$url = 'https://api.faucetsolution.com.tw/v1/energy/summary?start_date=2023-01-01&end_date=2023-01-31&granularity=day';
$options = [
'http' => [
'header' => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
],
'method' => 'GET'
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
# Python Example
import requests
url = "https://api.faucetsolution.com.tw/v1/energy/summary"
params = {
"start_date": "2023-01-01",
"end_date": "2023-01-31",
"granularity": "day"
}
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
// Java Example
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class EnergySummary {
public static void main(String[] args) throws Exception {
String startDate = "2023-01-01";
String endDate = "2023-01-31";
String granularity = "day";
String url = "https://api.faucetsolution.com.tw/v1/energy/summary?start_date=" +
URLEncoder.encode(startDate, StandardCharsets.UTF_8) +
"&end_date=" + URLEncoder.encode(endDate, StandardCharsets.UTF_8) +
"&granularity=" + URLEncoder.encode(granularity, StandardCharsets.UTF_8);
String apiKey = "YOUR_API_KEY";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// C# Example
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.faucetsolution.com.tw/v1/energy/summary?start_date=2023-01-01&end_date=2023-01-31&granularity=day"),
Headers = {
{ "Authorization", "Bearer YOUR_API_KEY" }
}
};
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
Query abnormal energy consumption events during specified period, can set threshold to define abnormal standard.
Request Parameters
Parameter
Type
Description
start_date
YYYY-MM-DD
Required, start date
end_date
YYYY-MM-DD
Required, end date
threshold
number
Optional, abnormal threshold (multiple of standard deviation), defaults to 2.0
device_ids
string[]
Optional, device ID list, multiple IDs separated by commas
Response Example
{
"status": "success",
"data": {
"total_abnormal_events": 3,
"average_usage": 45.2,
"standard_deviation": 12.3,
"threshold": 2.0,
"unit": "kWh",
"events": [
{
"timestamp": "2023-01-15T14:30:00Z",
"device_id": "dev_12345",
"energy_usage": 82.5,
"deviation": 3.03,
"possible_cause": "Device overload or malfunction",
"suggested_action": "Check device status, consider maintenance or replacement"
},
{
"timestamp": "2023-01-20T09:15:00Z",
"device_id": "dev_12345",
"energy_usage": 78.3,
"deviation": 2.69,
"possible_cause": "Unplanned operation",
"suggested_action": "Check schedule settings"
}
]
}
}
Code Examples
PHP
Python
Java
C#
// PHP Example
$url = 'https://api.faucetsolution.com.tw/v1/energy/abnormal?start_date=2023-01-01&end_date=2023-01-31&threshold=2.0';
$options = [
'http' => [
'header' => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
],
'method' => 'GET'
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
# Python Example
import requests
url = "https://api.faucetsolution.com.tw/v1/energy/abnormal"
params = {
"start_date": "2023-01-01",
"end_date": "2023-01-31",
"threshold": 2.0
}
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
// Java Example
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class EnergyAbnormal {
public static void main(String[] args) throws Exception {
String startDate = "2023-01-01";
String endDate = "2023-01-31";
double threshold = 2.0;
String url = "https://api.faucetsolution.com.tw/v1/energy/abnormal?start_date=" +
URLEncoder.encode(startDate, StandardCharsets.UTF_8) +
"&end_date=" + URLEncoder.encode(endDate, StandardCharsets.UTF_8) +
"&threshold=" + threshold;
String apiKey = "YOUR_API_KEY";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// C# Example
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.faucetsolution.com.tw/v1/energy/abnormal?start_date=2023-01-01&end_date=2023-01-31&threshold=2.0"),
Headers = {
{ "Authorization", "Bearer YOUR_API_KEY" }
}
};
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}