Two APIs, Two Use Cases
Ecowitt provides two useful interfaces for developers. The first is the gateway’s local HTTP API, which is ideal for reading current sensor values from a GW3000, GW2000 or GW1100 on your home network. The second is the Ecowitt Cloud API, which uses an Application Key and API Key to access devices and data through Ecowitt.net.
The local API is often the simplest option for a home setup. The GW3000’s documentation describes endpoints such as get_livedata_info, get_device_info, get_sensors_info and get_network_info, with JSON responses and standard HTTP requests.
The cloud API is better when you need to access a station remotely, work with historical observations, or build a service that is not running on the same local network as the gateway. Ecowitt requires both an Application Key and an API Key for cloud API calls, and imposes rate limits of three requests per second for the Application Key and one request per second for the API Key.
Before You Start
For the local examples below, you will need:
-
- An Ecowitt gateway such as the GW3000, GW2000 or GW1100
-
- The gateway’s local IP address, for example
192.168.1.50
- The gateway’s local IP address, for example
-
- A browser-based page, Node.js application or server-side script
-
- At least one compatible Ecowitt sensor paired with the gateway
Find the gateway’s IP address in your router’s DHCP client list, or check the network settings in the Ecowitt app. The GW3000 also provides a local WebUI, and its documentation identifies 192.168.4.1 as a configuration address in some setup scenarios.
Read Live Data Locally
The most useful local endpoint is get_livedata_info. It returns a JSON object containing current readings from the sensors connected to the gateway, including indoor and outdoor temperature, humidity, pressure, wind, rain, solar radiation, soil moisture, air quality and more, depending on the hardware you own.
A basic request looks like this:
GET http://192.168.1.50/get_livedata_info?
Here is a small JavaScript function that retrieves the response using the modern Fetch API:
async function getEcowittLiveData(gatewayIp) {
const response = await fetch(`http://${gatewayIp}/get_livedata_info?`);
if (!response.ok) {
throw new Error(`Ecowitt gateway returned HTTP ${response.status}`);
}
return response.json();
}
// Example usage
getEcowittLiveData("192.168.1.50")
.then((data) => {
console.log(data);
})
.catch((error) => {
console.error("Unable to read Ecowitt data:", error);
});
Replace 192.168.1.50 with the actual IP address of your GW3000. The response structure varies according to the sensors connected, so it is best to log the complete JSON first before writing code that expects particular fields.
Extract Useful Values
The local API’s common_list array uses numeric IDs for measurements. For example, Ecowitt’s documentation identifies 0x02 as outdoor temperature, 0x07 as outdoor humidity, 0x09 as relative barometric pressure, 0x0B as wind speed and 0x10 as daily rainfall.
The following helper turns that array into an easier-to-use object:
function parseCommonList(data) {
const readings = {};
if (!Array.isArray(data.common_list)) {
return readings;
}
for (const item of data.common_list) {
readings[item.id] = {
value: item.val,
unit: item.unit || null,
battery: item.battery ?? null
};
}
return readings;
}
async function showWeatherSummary(gatewayIp) {
const data = await getEcowittLiveData(gatewayIp);
const readings = parseCommonList(data);
const outdoorTemperature = readings["0x02"];
const outdoorHumidity = readings["0x07"];
const pressure = readings["0x09"];
const windSpeed = readings["0x0B"];
const dailyRain = readings["0x10"];
console.log({
outdoorTemperature,
outdoorHumidity,
pressure,
windSpeed,
dailyRain
});
}
This approach is deliberately defensive. Not every Ecowitt installation has every sensor, and a GW3000 used indoors may return only the built-in temperature, humidity and pressure readings rather than wind, rain or solar data.
A Simple Browser Dashboard
For a browser-based dashboard, you can request the gateway directly and update the page at a sensible interval. Because the gateway is on your local network, this works well when the page is opened from a device connected to the same network.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ecowitt Live Weather</title>
</head>
<body>
<h1>Ecowitt Live Weather</h1>
<ul>
<li>Outdoor temperature: <span id="temperature">—</span></li>
<li>Outdoor humidity: <span id="humidity">—</span></li>
<li>Relative pressure: <span id="pressure">—</span></li>
<li>Wind speed: <span id="wind">—</span></li>
<li>Rain today: <span id="rain">—</span></li>
</ul>
<script>
const gatewayIp = "192.168.1.50";
function getValue(readings, id) {
return readings[id]?.val ?? "Not available";
}
async function updateWeather() {
try {
const response = await fetch(`http://${gatewayIp}/get_livedata_info?`);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
const readings = {};
for (const item of data.common_list || []) {
readings[item.id] = item;
}
document.getElementById("temperature").textContent =
getValue(readings, "0x02");
document.getElementById("humidity").textContent =
getValue(readings, "0x07");
document.getElementById("pressure").textContent =
getValue(readings, "0x09");
document.getElementById("wind").textContent =
getValue(readings, "0x0B");
document.getElementById("rain").textContent =
getValue(readings, "0x10");
} catch (error) {
console.error("Ecowitt update failed:", error);
}
}
updateWeather();
setInterval(updateWeather, 60000);
</script>
</body>
</html>
The one-minute refresh interval is a sensible starting point. It avoids hammering the gateway while still keeping a dashboard reasonably current.
Use Node.js for a Local Service
For a more robust setup, run a small Node.js service that polls the gateway and exposes the data through your own API. This is useful if you want to log readings to a database, trigger automations, feed Grafana, or make the data available to other applications.
const express = require("express");
const app = express();
const GATEWAY_IP = process.env.ECOWITT_IP || "192.168.1.50";
const PORT = process.env.PORT || 3000;
let latestReadings = null;
let lastUpdated = null;
async function fetchLiveData() {
const response = await fetch(`http://${GATEWAY_IP}/get_livedata_info?`);
if (!response.ok) {
throw new Error(`Ecowitt gateway returned HTTP ${response.status}`);
}
latestReadings = await response.json();
lastUpdated = new Date().toISOString();
}
function findValue(id) {
const item = latestReadings?.common_list?.find(
(entry) => entry.id === id
);
return item ? {
value: item.val,
unit: item.unit || null
} : null;
}
app.get("/api/weather", (request, response) => {
if (!latestReadings) {
return response.status(503).json({
error: "No Ecowitt data available yet"
});
}
response.json({
updated: lastUpdated,
outdoorTemperature: findValue("0x02"),
outdoorHumidity: findValue("0x07"),
relativePressure: findValue("0x09"),
windSpeed: findValue("0x0B"),
rainToday: findValue("0x10")
});
});
async function start() {
await fetchLiveData();
setInterval(async () => {
try {
await fetchLiveData();
} catch (error) {
console.error("Ecowitt polling failed:", error.message);
}
}, 60000);
app.listen(PORT, () => {
console.log(`Ecowitt API service listening on port ${PORT}`);
});
}
start().catch((error) => {
console.error("Failed to start Ecowitt service:", error);
process.exit(1);
});
Run it with:
ECOWITT_IP=192.168.1.50 node server.js
Then request your own simplified endpoint:
GET http://localhost:3000/api/weather
This pattern keeps the Ecowitt gateway out of the browser and gives you a stable JSON interface for the rest of your smart-home or monitoring stack.
Using the Ecowitt Cloud API
If your Ecowitt station uploads to Ecowitt.net, you can use the official Cloud API instead of querying the gateway locally. Sign in to Ecowitt.net, open your account area and create both an Application Key and an API Key in the Private Centre.
The cloud API is designed for app and website integrations, returns JSON, supports ports 80 and 443, and is free to use subject to its request-rate limits.
A basic JavaScript client should keep both keys in environment variables rather than embedding them in client-side code:
const ECOWITT_APPLICATION_KEY = process.env.ECOWITT_APPLICATION_KEY;
const ECOWITT_API_KEY = process.env.ECOWITT_API_KEY;
const ECOWITT_MAC = process.env.ECOWITT_MAC;
if (!ECOWITT_APPLICATION_KEY || !ECOWITT_API_KEY || !ECOWITT_MAC) {
throw new Error(
"Set ECOWITT_APPLICATION_KEY, ECOWITT_API_KEY and ECOWITT_MAC"
);
}
async function getEcowittCloudData() {
const url = new URL("https://api.ecowitt.net/api/v3/device/real_time");
url.searchParams.set("application_key", ECOWITT_APPLICATION_KEY);
url.searchParams.set("api_key", ECOWITT_API_KEY);
url.searchParams.set("mac", ECOWITT_MAC);
url.searchParams.set("call_back", "all");
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Ecowitt Cloud API returned HTTP ${response.status}`);
}
return response.json();
}
getEcowittCloudData()
.then((data) => console.log(JSON.stringify(data, null, 2)))
.catch((error) => console.error(error));
The exact endpoint, parameters and response fields can change between API versions, so always check the current Ecowitt API documentation before deploying a production integration. Ecowitt’s documentation centre identifies the Cloud API as version 3 and separates it from the gateway’s local IoT interface.
Security and Good Practice
Do not expose your Ecowitt gateway directly to the internet. The local HTTP API is convenient on a trusted home network, but it is not a substitute for a properly secured public web service.
-
- Keep the GW3000 on your local network, behind your router and firewall.
-
- Use a small server-side proxy if a public website needs access to the data.
-
- Store cloud API keys in environment variables or a secrets manager, never in browser JavaScript.
-
- Respect Ecowitt’s rate limits; avoid polling more often than your application genuinely needs.
-
- Handle missing sensors gracefully, because the available JSON fields depend on your hardware.
-
- Log errors rather than silently failing, especially if the gateway is part of an automation system.
Practical Project Ideas
-
- Live weather dashboard: Display outdoor temperature, humidity, wind, rainfall and pressure in a browser page.
-
- Garden irrigation logic: Combine soil-moisture readings with rainfall data before deciding whether to water.
-
- Frost alerts: Trigger a notification when outdoor temperature approaches freezing.
-
- Home Assistant integration: Feed live Ecowitt values into automations and dashboards.
-
- Local archive: Poll the GW3000 and store observations in SQLite, PostgreSQL or InfluxDB.
-
- Amateur radio weather page: Publish current conditions from your own station to a personal website or APRS-style dashboard.
Final Thoughts
The Ecowitt API makes a GW3000 much more than a weather-data collector. With a few lines of JavaScript, you can turn sensor readings into dashboards, automations, archives and custom web services.
For most home users, start with the local get_livedata_info endpoint. It is fast, simple and ideal for a private dashboard. Move to the Ecowitt Cloud API when you need remote access, historical data or a multi-device integration. Either way, JavaScript gives you an accessible and flexible route from weather sensors to useful information.
The Official API documentation is located at ecowitt.net
Disclosure: This article is based on publicly available Ecowitt documentation and product information. API endpoints, response formats, rate limits and device behavior may change between firmware and documentation versions.

Leave a Reply
You must be logged in to post a comment.