đ Emlog API Referenz
January 15, 2026 · View on GitHub
VollstÀndige Dokumentation der Emlog HTTP-API und Datenstruktur.
đ Endpoints
Meter Information
GET http://{host}:80/pages/getinformation.php?export&meterindex={index}
Parameter:
host: IP-Adresse des Emlog GerĂ€ts (z.B. 192.168.1.100)meterindex: Meter-Index (Integer, typisch 1 fĂŒr Strom, 2 fĂŒr Gas)export: Aktiviert JSON Export Format
Response: JSON mit vollstÀndigen Meter-Daten
đ Response Struktur
GrundgerĂŒst
{
"product": "Emlog - Electronic Meter Log",
"version": 1.16,
"Zaehlerstand_Bezug": {}, // ZÀhlerstÀnde (Bezug)
"Zaehlerstand_Lieferung": {}, // ZÀhlerstÀnde (Lieferung)
"Wirkleistung_Bezug": {}, // Leistung (Bezug)
"Wirkleistung_Lieferung": {}, // Leistung (Lieferung)
"Kwh_Bezug": {}, // kWh Verbrauch
"Kwh_Lieferung": {}, // kWh Erzeugung
"Betrag_Bezug": {}, // Kosten (Bezug)
"Betrag_Lieferung": {}, // Kosten (Lieferung)
"DiffBezugLieferung": {} // Differenz Bezug/Lieferung
}
đ Elektrischer Strom (Meterindex 1)
ZÀhlerstÀnde (Zaehlerstand_Bezug)
{
"Stand180": 12345.67, // GesamtzÀhler (kWh)
"Stand181": 1000.0, // Tarif 1 (kWh) - Niedertarif
"Stand182": 2345.67, // Tarif 2 (kWh) - Hochtarif
"Stand183": 9000.0 // (optional) Tarif 3 (kWh)
}
ZÀhlerstÀnde (Zaehlerstand_Lieferung)
{
"Stand280": 5000.0, // GesamtzÀhler PV Erzeugung (kWh)
"Stand281": 3000.0, // Tarif 1 PV (kWh)
"Stand282": 2000.0 // Tarif 2 PV (kWh)
}
Aktuelle Leistung (Wirkleistung_Bezug) in W
{
"Leistung170": 1500, // Phase L1 (W)
"Leistung171": 1600, // Phase L2 (W)
"Leistung172": 1700, // Phase L3 (W)
"Leistung173": 1500 // Summe aller Phasen (W)
}
Aktuelle Leistung (Wirkleistung_Lieferung) in W
{
"Leistung270": 500, // Phase L1 PV (W)
"Leistung271": 400, // Phase L2 PV (W)
"Leistung272": 300, // Phase L3 PV (W)
"Leistung273": 500 // Summe PV (W)
}
Verbrauch & Kosten
// Kwh_Bezug: Kumulierte Kilowattstunden
{
"Kwh180": 12345.67, // Gesamtverbrauch (kWh)
"Kwh181": 1000.00, // Tarif 1 Verbrauch (kWh)
"Kwh182": 2345.67 // Tarif 2 Verbrauch (kWh)
}
// Betrag_Bezug: Kosten
{
"Betrag180": 3500.00, // Gesamtkosten (EUR)
"Betrag181": 1000.00, // Tarif 1 Kosten (EUR)
"Betrag182": 2500.00, // Tarif 2 Kosten (EUR)
"Waehrung": "EUR" // WĂ€hrung
}
đ„ Gas (Meterindex 2)
ZÀhlerstÀnde (Zaehlerstand_Bezug)
{
"Stand180": 100000.5, // GesamtzÀhler (m³)
"Stand181": 50000.0, // Tarif 1 (mÂł)
"Stand182": 50000.5 // Tarif 2 (mÂł)
}
Aktuelle Leistung (Wirkleistung_Bezug) in W
{
"Leistung170": 15000, // Momentane Leistung (W)
"Leistung171": 0,
"Leistung172": 0,
"Leistung173": 15000 // Summe (W)
}
Verbrauch (Kwh_Bezug) in kWh
{
"Kwh180": 1000000.0, // Gesamtverbrauch (kWh)
"Kwh181": 500000.0, // Tarif 1 (kWh)
"Kwh182": 500000.0 // Tarif 2 (kWh)
}
đč Sensor-Mapping in Integration
Von JSON zu Home Assistant Sensoren
# Electricity Sensors (Meterindex 1)
STROM_SENSORS = [
# ZÀhlerstÀnde
EmlogSensorDef("zaehlerstand_kwh", ..., "Stand180"),
EmlogSensorDef("tarif1_kwh", ..., "Stand181"),
EmlogSensorDef("tarif2_kwh", ..., "Stand182"),
# Aktuelle Leistung
EmlogSensorDef("leistung_w", ..., "Leistung173"),
EmlogSensorDef("leistung_l1_w", ..., "Leistung170"),
# Verbrauch
EmlogSensorDef("verbrauch_kwh", ..., "Kwh180"),
]
# Gas Sensors (Meterindex 2)
GAS_SENSORS = [
EmlogSensorDef("gas_zaehlerstand_m3", ..., "Stand180"),
EmlogSensorDef("gas_leistung_w", ..., "Leistung173"),
]
đ Datentypen & Einheiten
ZÀhlerstÀnde
- Datentyp: Float (Dezimal)
- Einheit: kWh (Strom), mÂł (Gas)
- State Class:
TOTAL_INCREASING(steigt immer/bleibt gleich) - Device Class:
ENERGY,VOLUME
Leistung
- Datentyp: Integer
- Einheit: W (Watt)
- State Class:
MEASUREMENT(kann variieren) - Device Class:
POWER
Kosten
- Datentyp: Float (Dezimal)
- Einheit: EUR, andere WÀhrungen möglich
- State Class:
TOTALoderTOTAL_INCREASING - Device Class:
MONETARY
đ Beispiel-Requests
cURL
# Strom abrufen
curl "http://192.168.1.100/pages/getinformation.php?export&meterindex=1"
# Gas abrufen
curl "http://192.168.1.100/pages/getinformation.php?export&meterindex=2"
Python
import aiohttp
async with aiohttp.ClientSession() as session:
url = "http://192.168.1.100/pages/getinformation.php"
params = {"export": "", "meterindex": 1}
async with session.get(url, params=params, timeout=10) as resp:
data = await resp.json(content_type=None)
# Extrahiere ZĂ€hlerstand
zaehler = data.get("Zaehlerstand_Bezug", {}).get("Stand180", 0)
print(f"ZĂ€hlerstand: {zaehler} kWh")
â ïž Fehlerbehandlung
Mögliche Fehler
| Status | Ursache | Lösung |
|---|---|---|
| 404 | Endpoint nicht erreichbar | PrĂŒfe IP & Port |
| 500 | Server Error | Emlog Device Neustart |
| Timeout | Netzwerkprobleme | Netzwerk prĂŒfen, Timeout erhöhen |
| JSON Error | UngĂŒltiges Response Format | Emlog Version prĂŒfen |
Integration Error Handling
try:
async with session.get(url, timeout=10) as resp:
if resp.status != 200:
raise UpdateFailed(f"HTTP {resp.status}")
return await resp.json(content_type=None)
except asyncio.TimeoutError as err:
raise UpdateFailed(f"Timeout: {url}") from err
except aiohttp.ClientError as err:
raise UpdateFailed(f"Connection error: {err}") from err
except json.JSONDecodeError as err:
raise UpdateFailed(f"Invalid JSON response: {err}") from err
đ§Ș Mock Server
FĂŒr Tests ohne physisches Emlog GerĂ€t:
# Mock Server starten
make mock-up
# API testen
curl "http://localhost:8080/pages/getinformation.php?export&meterindex=1"
Der Mock Server simuliert realistische Daten mit:
- ZufÀlliger Variation (Leistung)
- TĂ€glichen Zyklen (Gasverbrauch)
- Persistenten ZĂ€hlern (state.json)
đ Weitere Ressourcen
- Emlog Handbuch (Hersteller)
- Integration Architektur
- GitHub Issues
API Version: 1.16 (aktuell in Emlog)
Zuletzt aktualisiert: 2025-01-15