From 0831ea47b0861da971eb4b33b0e9cf33f8e48104 Mon Sep 17 00:00:00 2001 From: nero150 <95982029+nero150@users.noreply.github.com> Date: Wed, 18 Mar 2026 09:34:08 +0100 Subject: [PATCH] Add files via upload --- README.md | 72 +++++++++++----------- custom_components/xt211_han/dlms_parser.py | 64 +++++++++++-------- custom_components/xt211_han/sensor.py | 19 ++++-- 3 files changed, 87 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index ed035b3..1d9e734 100644 --- a/README.md +++ b/README.md @@ -73,49 +73,51 @@ Napájení USR-DR134: 5–24V DC (např. z USB adaptéru přes step-up, nebo 12V --- -## Dostupné entity +## Dostupné entity (27 celkem) ### 📊 Výkon (W) – okamžité hodnoty -| Název entity | OBIS kód | -|---|---| -| Active Power Consumption | `1-0:1.7.0.255` | -| Active Power Consumption L1 | `1-0:21.7.0.255` | -| Active Power Consumption L2 | `1-0:41.7.0.255` | -| Active Power Consumption L3 | `1-0:61.7.0.255` | -| Active Power Delivery | `1-0:2.7.0.255` | -| Active Power Delivery L1 | `1-0:22.7.0.255` | -| Active Power Delivery L2 | `1-0:42.7.0.255` | -| Active Power Delivery L3 | `1-0:62.7.0.255` | -| Limiter Value | `0-0:17.0.0.255` | +| # | Název entity | OBIS kód | +|---|---|---| +| 5 | Power Limiter Value | `0-0:17.0.0.255` | +| 13 | Active Power Import | `1-0:1.7.0.255` | +| 14 | Active Power Import L1 | `1-0:21.7.0.255` | +| 15 | Active Power Import L2 | `1-0:41.7.0.255` | +| 16 | Active Power Import L3 | `1-0:61.7.0.255` | +| 17 | Active Power Export | `1-0:2.7.0.255` | +| 18 | Active Power Export L1 | `1-0:22.7.0.255` | +| 19 | Active Power Export L2 | `1-0:42.7.0.255` | +| 20 | Active Power Export L3 | `1-0:62.7.0.255` | ### ⚡ Energie (kWh) – kumulativní -| Název entity | OBIS kód | -|---|---| -| Energy Consumed | `1-0:1.8.0.255` | -| Energy Consumed T1 | `1-0:1.8.1.255` | -| Energy Consumed T2 | `1-0:1.8.2.255` | -| Energy Consumed T3 | `1-0:1.8.3.255` | -| Energy Consumed T4 | `1-0:1.8.4.255` | -| Energy Delivered | `1-0:2.8.0.255` | -| Energy Delivered T1 | `1-0:2.8.1.255` | -| Energy Delivered T2 | `1-0:2.8.2.255` | -| Energy Delivered T3 | `1-0:2.8.3.255` | -| Energy Delivered T4 | `1-0:2.8.4.255` | +| # | Název entity | OBIS kód | +|---|---|---| +| 21 | Energy Import | `1-0:1.8.0.255` | +| 22 | Energy Import T1 | `1-0:1.8.1.255` | +| 23 | Energy Import T2 | `1-0:1.8.2.255` | +| 24 | Energy Import T3 | `1-0:1.8.3.255` | +| 25 | Energy Import T4 | `1-0:1.8.4.255` | +| 26 | Energy Export | `1-0:2.8.0.255` | ### 🔀 Binární senzory (zapnuto/vypnuto) -| Název entity | OBIS kód | -|---|---| -| Disconnector Status | `0-0:96.3.10.255` | -| Relay R1 Status | `0-1:96.3.10.255` | -| Relay R2 Status | `0-2:96.3.10.255` | -| Relay R3 Status | `0-3:96.3.10.255` | -| Relay R4 Status | `0-4:96.3.10.255` | +| # | Název entity | OBIS kód | +|---|---|---| +| 4 | Disconnector Status | `0-0:96.3.10.255` | +| 6 | Relay R1 Status | `0-1:96.3.10.255` | +| 7 | Relay R2 Status | `0-2:96.3.10.255` | +| 8 | Relay R3 Status | `0-3:96.3.10.255` | +| 9 | Relay R4 Status | `0-4:96.3.10.255` | +| 10 | Relay R5 Status | `0-5:96.3.10.255` | +| 11 | Relay R6 Status | `0-6:96.3.10.255` | ### 📋 Diagnostika (text) -| Název entity | OBIS kód | -|---|---| -| Serial Number | `0-0:96.1.1.255` | -| Current Tariff | `0-0:96.14.0.255` | +| # | Název entity | OBIS kód | +|---|---|---| +| 1 | COSEM Logical Device Name | `0-0:42.0.0.255` | +| 3 | Serial Number | `0-0:96.1.0.255` | +| 12 | Current Tariff | `0-0:96.14.0.255` | +| 27 | Consumer Message | `0-0:96.13.0.255` | + +> ℹ️ Idx 2 (`0-2:25.9.0.255` – Push setup) je interní konfigurační objekt elektroměru, neobsahuje měřená data. --- diff --git a/custom_components/xt211_han/dlms_parser.py b/custom_components/xt211_han/dlms_parser.py index 68af542..657d524 100644 --- a/custom_components/xt211_han/dlms_parser.py +++ b/custom_components/xt211_han/dlms_parser.py @@ -436,41 +436,51 @@ class DLMSParser: # --------------------------------------------------------------------------- OBIS_DESCRIPTIONS: dict[str, dict] = { - # --- Diagnostic / text --- - "0-0:96.1.1.255": {"name": "Serial Number", "unit": "", "class": "text"}, - "0-0:96.14.0.255": {"name": "Current Tariff", "unit": "", "class": "text"}, - "0-0:17.0.0.255": {"name": "Limiter Value", "unit": "W", "class": "power"}, + # --- Idx 1: COSEM logical device name --- + "0-0:42.0.0.255": {"name": "COSEM Logical Device Name", "unit": "", "class": "text"}, - # --- Binary (disconnector / relays) --- + # --- Idx 3: Serial number (opravený OBIS!) --- + "0-0:96.1.0.255": {"name": "Serial Number", "unit": "", "class": "text"}, + + # --- Idx 4: Disconnector --- "0-0:96.3.10.255": {"name": "Disconnector Status", "unit": "", "class": "binary"}, + + # --- Idx 5: Power limiter --- + "0-0:17.0.0.255": {"name": "Power Limiter Value", "unit": "W", "class": "power"}, + + # --- Idx 6–11: Relays R1–R6 --- "0-1:96.3.10.255": {"name": "Relay R1 Status", "unit": "", "class": "binary"}, "0-2:96.3.10.255": {"name": "Relay R2 Status", "unit": "", "class": "binary"}, "0-3:96.3.10.255": {"name": "Relay R3 Status", "unit": "", "class": "binary"}, "0-4:96.3.10.255": {"name": "Relay R4 Status", "unit": "", "class": "binary"}, + "0-5:96.3.10.255": {"name": "Relay R5 Status", "unit": "", "class": "binary"}, + "0-6:96.3.10.255": {"name": "Relay R6 Status", "unit": "", "class": "binary"}, - # --- Instant power – consumption (odběr) --- - "1-0:1.7.0.255": {"name": "Active Power Consumption", "unit": "W", "class": "power"}, - "1-0:21.7.0.255": {"name": "Active Power Consumption L1", "unit": "W", "class": "power"}, - "1-0:41.7.0.255": {"name": "Active Power Consumption L2", "unit": "W", "class": "power"}, - "1-0:61.7.0.255": {"name": "Active Power Consumption L3", "unit": "W", "class": "power"}, + # --- Idx 12: Active tariff --- + "0-0:96.14.0.255": {"name": "Current Tariff", "unit": "", "class": "text"}, - # --- Instant power – delivery (dodávka / FVE) --- - "1-0:2.7.0.255": {"name": "Active Power Delivery", "unit": "W", "class": "power"}, - "1-0:22.7.0.255": {"name": "Active Power Delivery L1", "unit": "W", "class": "power"}, - "1-0:42.7.0.255": {"name": "Active Power Delivery L2", "unit": "W", "class": "power"}, - "1-0:62.7.0.255": {"name": "Active Power Delivery L3", "unit": "W", "class": "power"}, + # --- Idx 13–16: Instant power import (odběr) --- + "1-0:1.7.0.255": {"name": "Active Power Import", "unit": "W", "class": "power"}, + "1-0:21.7.0.255": {"name": "Active Power Import L1", "unit": "W", "class": "power"}, + "1-0:41.7.0.255": {"name": "Active Power Import L2", "unit": "W", "class": "power"}, + "1-0:61.7.0.255": {"name": "Active Power Import L3", "unit": "W", "class": "power"}, - # --- Energy – consumption (odběr kWh) --- - "1-0:1.8.0.255": {"name": "Energy Consumed", "unit": "Wh", "class": "energy"}, - "1-0:1.8.1.255": {"name": "Energy Consumed T1", "unit": "Wh", "class": "energy"}, - "1-0:1.8.2.255": {"name": "Energy Consumed T2", "unit": "Wh", "class": "energy"}, - "1-0:1.8.3.255": {"name": "Energy Consumed T3", "unit": "Wh", "class": "energy"}, - "1-0:1.8.4.255": {"name": "Energy Consumed T4", "unit": "Wh", "class": "energy"}, + # --- Idx 17–20: Instant power export (dodávka / FVE) --- + "1-0:2.7.0.255": {"name": "Active Power Export", "unit": "W", "class": "power"}, + "1-0:22.7.0.255": {"name": "Active Power Export L1", "unit": "W", "class": "power"}, + "1-0:42.7.0.255": {"name": "Active Power Export L2", "unit": "W", "class": "power"}, + "1-0:62.7.0.255": {"name": "Active Power Export L3", "unit": "W", "class": "power"}, - # --- Energy – delivery (dodávka kWh, FVE přetoky) --- - "1-0:2.8.0.255": {"name": "Energy Delivered", "unit": "Wh", "class": "energy"}, - "1-0:2.8.1.255": {"name": "Energy Delivered T1", "unit": "Wh", "class": "energy"}, - "1-0:2.8.2.255": {"name": "Energy Delivered T2", "unit": "Wh", "class": "energy"}, - "1-0:2.8.3.255": {"name": "Energy Delivered T3", "unit": "Wh", "class": "energy"}, - "1-0:2.8.4.255": {"name": "Energy Delivered T4", "unit": "Wh", "class": "energy"}, + # --- Idx 21–25: Cumulative energy import (odběr kWh) --- + "1-0:1.8.0.255": {"name": "Energy Import", "unit": "Wh", "class": "energy"}, + "1-0:1.8.1.255": {"name": "Energy Import T1", "unit": "Wh", "class": "energy"}, + "1-0:1.8.2.255": {"name": "Energy Import T2", "unit": "Wh", "class": "energy"}, + "1-0:1.8.3.255": {"name": "Energy Import T3", "unit": "Wh", "class": "energy"}, + "1-0:1.8.4.255": {"name": "Energy Import T4", "unit": "Wh", "class": "energy"}, + + # --- Idx 26: Cumulative energy export (dodávka kWh) --- + "1-0:2.8.0.255": {"name": "Energy Export", "unit": "Wh", "class": "energy"}, + + # --- Idx 27: Consumer message text --- + "0-0:96.13.0.255": {"name": "Consumer Message", "unit": "", "class": "text"}, } diff --git a/custom_components/xt211_han/sensor.py b/custom_components/xt211_han/sensor.py index 7d0e16d..6967cd1 100644 --- a/custom_components/xt211_han/sensor.py +++ b/custom_components/xt211_han/sensor.py @@ -58,15 +58,22 @@ SENSOR_META: dict[str, dict] = { } # OBIS codes that send text values (not numeric) -TEXT_OBIS = {"0-0:96.1.1.255", "0-0:96.14.0.255"} +TEXT_OBIS = { + "0-0:42.0.0.255", # COSEM logical device name + "0-0:96.1.0.255", # Serial number + "0-0:96.14.0.255", # Current tariff + "0-0:96.13.0.255", # Consumer message +} # OBIS codes that are binary (on/off) BINARY_OBIS = { - "0-0:96.3.10.255", - "0-1:96.3.10.255", - "0-2:96.3.10.255", - "0-3:96.3.10.255", - "0-4:96.3.10.255", + "0-0:96.3.10.255", # Disconnector + "0-1:96.3.10.255", # Relay R1 + "0-2:96.3.10.255", # Relay R2 + "0-3:96.3.10.255", # Relay R3 + "0-4:96.3.10.255", # Relay R4 + "0-5:96.3.10.255", # Relay R5 + "0-6:96.3.10.255", # Relay R6 }