diff --git a/.gitignore b/.gitignore
index d8b4157..fa17b99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
# You can modify this file to suit your needs.
/.esphome/
/secrets.yaml
+/.idea
diff --git a/3d print/Box.png b/3d print/Box.png
new file mode 100644
index 0000000..2df64a7
Binary files /dev/null and b/3d print/Box.png differ
diff --git a/3d print/Box.stl b/3d print/Box.stl
new file mode 100644
index 0000000..c9f5f3a
Binary files /dev/null and b/3d print/Box.stl differ
diff --git a/3d print/Frame XT211 Wide.png b/3d print/Frame XT211 Wide.png
new file mode 100644
index 0000000..981cac8
Binary files /dev/null and b/3d print/Frame XT211 Wide.png differ
diff --git a/3d print/Frame XT211 Wide.stl b/3d print/Frame XT211 Wide.stl
new file mode 100644
index 0000000..6fcf0f3
Binary files /dev/null and b/3d print/Frame XT211 Wide.stl differ
diff --git a/3d print/Sensor_bottom_side_v1.png b/3d print/Sensor_bottom_side_v1.png
new file mode 100644
index 0000000..be44ea6
Binary files /dev/null and b/3d print/Sensor_bottom_side_v1.png differ
diff --git a/3d print/Sensor_bottom_side_v1.stl b/3d print/Sensor_bottom_side_v1.stl
new file mode 100644
index 0000000..70359c2
Binary files /dev/null and b/3d print/Sensor_bottom_side_v1.stl differ
diff --git a/3d print/Sensor_top_side_v1.png b/3d print/Sensor_top_side_v1.png
new file mode 100644
index 0000000..0ebbcc3
Binary files /dev/null and b/3d print/Sensor_top_side_v1.png differ
diff --git a/3d print/Sensor_top_side_v1.stl b/3d print/Sensor_top_side_v1.stl
new file mode 100644
index 0000000..f8e92fc
Binary files /dev/null and b/3d print/Sensor_top_side_v1.stl differ
diff --git a/README.cz.md b/README.cz.md
new file mode 100644
index 0000000..4dfed42
--- /dev/null
+++ b/README.cz.md
@@ -0,0 +1,353 @@
+# ESPHome DLMS/Cosem PUSH RS485 čtení
+### [[English Version]](README.md)
+
+Můj poskytovatel elektřiny (ČEZ Distribuce) mi právě nainstaloval nový chytrý elektroměr. Až do teď jsem používal [Home Assistant Glow](https://glow-energy.io/) pro sledování spotřeby domácnosti. Takže jsem byl nadšený, že se konečně dostanu k novému elektroměru a zkusím z něj číst data. Bohužel to nebylo tak jednoduché, jak jsem doufal, ale po mnoha neúspěšných pokusech se mi to povedlo rozchodit a chci se s vámi podělit o zkušenosti.
+
+## Sagecom XT211 - Můj elektroměr
+
+[Stránky ČEZ Distribuce pro Sagecom XT211 AMM](https://www.cezdistribuce.cz/pro-zakazniky/potrebuji-vyresit/elektromery-a-odecty/pruvodce-elektromery/xt211-amm) | [Datasheet](documents/Datasheet_Sagemcom_XT211_EN.pdf)
+
+
+
+Sagecom XT211 je třífázový chytrý elektroměr podporující protokol DLMS/COSEM pro datovou komunikaci. Má integrované RS485 rozhraní, které lze použít pro čtení dat. Elektroměr je nastavený na PUSH komunikaci, což znamená, že každých 60 sekund sám odesílá data bez nutnosti dotazování.
+
+
+
+V mém případě byl port elektroměru připojen do zařízení WM-RelayBox, které slouží k dálkovému odpojování dodávky elektřiny. Rozhraní RS485 je přístupné přes RJ12 port na zařízení.
+
+
+
+### WM-RelayBox
+
+[Datasheet](documents/WM-RelayBox__Datasheet_2024-ENG_v3.pdf) | [Installation Guide](documents/WM-Relay_Box__Installation_Guide_EN_V3_1.pdf) | [Quick Guide](documents/WM-RelayBox__Quick_Guide_V1_00.pdf)
+
+RelayBox se připojuje k elektroměru (přes jeho RJ12 E-Meter port) a přijímá jednosměrné DLMS/COSEM PUSH zprávy a příkazy z Head-end systému prostřednictvím elektroměru.
+
+Potom provádí požadované akce relé a zároveň odesílá všechna data z elektroměru do zákaznického rozhraní HAN / P1 (oddělený, galvanicky izolovaný RJ12 port).
+
+
+
+### Zákaznické rozhraní HAN
+
+HAN port je izolovaný RJ12 port poskytující přístup k datům odesílaným elektroměrem. Port využívá RS485 komunikaci s následujícím zapojením:
+
+
+
+
+Některé zdroje uvádí, že pin 6 je připojen k zemi, jiné že se nepoužívá. Já mám připojené jen piny 3 a 4, protože pro RS485 potřebuji jen datové vodiče (a měl jsem jen RJ11 kabel bez pinů 1 a 6).
+
+| Pin | Signal |
+|-----|-------------|
+| 1 | Not used |
+| 2 | Not used |
+| 3 | Data A (+) |
+| 4 | Data B (-) |
+| 5 | Not used |
+| 6 | GND |
+
+### RS485 na TTL převodník
+
+Pro připojení HAN portu do ESPHome zařízení jsem použil RS485 na TTL převodník. Konkrétně tento modul z AliExpressu [ TTL To RS485](https://www.aliexpress.com/item/1005006828879851.html?spm=a2g0o.order_list.order_list_main.458.667a1802FPpBbB), ale existuje mnoho podobných.
+
+
+
+### Parametry RS485
+
+Parametry jsou definované v dokumentu [připojovací podmínky NN](documents/pripojovacipodminkynn.pdf) od ČEZ Distribuce:
+
+
+
+| Parameter | Hodnota |
+|-----------------|----------|
+| Baud rate | 9600 bps |
+| Data bits | 8 |
+| Start bits | 0 |
+| Stop bits | 1 |
+| Parity | None |
+| Flow control | None |
+
+## PulseMeter (Home Assistant Glow)
+
+Na [Home Assistant Glow](https://glow-energy.io/) jsem měl rád že se hodnoty aktualizovaly celkem rychle (podle frekvence pulzů). Nový elektroměr však posílá PUSH zprávy jen každých 60 sekund, což není ideální pro sledování okamžité spotřeby.
+
+Takže jsem to zkombinoval: PulseMeter používám pro okamžitý příkon (W) a DLMS/Cosem z ESPHome pro energii (kWh).
+
+Více o PulseMeteru najdeš v dokumentaci [Home Assistant Glow documentation](https://glow-energy.io/).
+
+### LM393 Fotodiodový senzor
+
+
+
+# Montáž
+
+ESPHome zařízení a RS485 převodník jsem dal do malé projektové krabičky.
+
+### [Box.stl](3d print/Box.stl)
+
+
+Krabičku pro fotodiodu jsem převzal z Home Assistant Glow.
+
+### [Sensor_bottom_side_v1.stl](3d print/Sensor_bottom_side_v1.stl)
+
+
+### [Sensor_top_side_v1.stl](3d print/Sensor_top_side_v1.stl)
+
+
+Vyrobil jsem rám pro upevnění senzoru na elektroměr XT211.
+
+### [Frame XT211 Wide.stl](3d print/Frame XT211 Wide.stl)
+
+
+# Schéma zapojení
+
+
+
+LM393 fotodioda:
+- VCC → 5V
+- GND → GND
+- DO (Digitální výstup) → GPIO6
+- AO (Analogový výstup) → GPIO5 (analogový vstup, volitelné)
+
+RS485 na TTL převodník:
+- VCC → 5V
+- GND → GND
+- TXD → RX (GPIO21)
+- RXD → TX (GPIO22)
+
+HAN port (RJ12 / RJ11):
+- B- (Data B) → HAN pin 4
+- A+ (Data A) → HAN pin 3
+- GND → pin 6 (volitelné)
+
+Activity LED (volitelné):
+- Anoda → GPIO4 (+ 220 ohmový rezistor)
+- Katoda → GND
+
+Power Led (volitelné):
+- Anoda → 5V (+ 220 ohmový rezistor - pro nižší jas)
+- Katoda → GND
+
+# Custom ESPHome komponenta
+
+Pro čtení PUSH zpráv DLMS/Cosem z XT211 jsem upravil existující projekt [esphome-dlms-cosem](https://github.com/latonita/esphome-dlms-cosem).
+
+Odstranil jsem polling, opravil pár chyb a přidal podporu pro binární senzory.
+
+Více detailů v projektu [esphome-dlms-cosem repository](https://github.com/latonita/esphome-dlms-cosem) od [latonita](https://github.com/latonita)
+
+## ESPHome konfigurace
+
+### Kompletní konfigurace: [esphome-smartmeter.yaml](esphome-smartmeter.yaml)
+
+Přidej externí komponentu:
+
+```yaml
+external_components:
+ - source: github://Tomer27cz/xt211
+ components: [xt211]
+```
+Poté nastav DLMS/Cosem komponentu:
+- push_show_log: true (volitelné, bude zobrazovat surové PUSH zprávy v logu pro debug a testování)
+
+Až to bude fungovat, logy vypni.
+
+```yaml
+uart:
+ id: bus_1
+ tx_pin: GPIO20
+ rx_pin: GPIO21
+ baud_rate: 9600
+ data_bits: 8
+ parity: NONE
+ stop_bits: 1
+
+xt211:
+ push_show_log: true
+```
+
+### Number sensor (`sensor`)
+Moje spotřeba elektřiny se měří v kWh, ale elektroměr odesílá hodnotu ve Wh. Proto používám lambda filtr k převodu hodnoty z Wh na kWh vydělením 1000.
+
+```yaml
+sensor:
+ - platform: xt211
+ id: active_energy_consumed
+ name: "Energy"
+ obis_code: 1.0.1.8.0.255
+ unit_of_measurement: kWh
+ accuracy_decimals: 3
+ device_class: energy
+ state_class: total_increasing
+ filters:
+ - lambda: "return x/1000.0;"
+```
+
+### Binary sensor (`binary_sensor`)
+Binární senzor má hodnotu `false`, pokud je hodnota 0, a hodnotu `true`, pokud je hodnota jakákoli jiná.
+
+```yaml
+binary_sensor:
+ - platform: xt211
+ name: "Relay 1"
+ obis_code: 0.1.96.3.10.255
+```
+
+### Text sensor (`text_sensor`)
+
+```yaml
+text_sensor:
+ - platform: xt211
+ name: "Serial number"
+ obis_code: 0.0.96.1.1.255
+ entity_category: diagnostic
+```
+
+### Pulzní měřič (`pulse_meter`) - pro monitorování spotřeby energie (W) v reálném čase
+
+```yaml
+time:
+ - platform: homeassistant
+ id: homeassistant_time
+
+number:
+ - platform: template
+ id: select_pulse_rate
+ name: 'Puls rate - imp/kWh'
+ optimistic: true
+ mode: box
+ min_value: 100
+ max_value: 10000
+ step: 100
+ restore_value: yes
+ initial_value: 1000
+
+sensor:
+ - platform: pulse_meter
+ name: 'Pulse Power Consumption'
+ id: sensor_energy_pulse_meter
+ unit_of_measurement: 'W'
+ state_class: measurement
+ device_class: power
+ icon: mdi:flash-outline
+ accuracy_decimals: 0
+ pin: GPIO6
+
+ on_raw_value:
+ then:
+ - switch.turn_on: indicator_led
+ - delay: 100ms
+ - switch.turn_off: indicator_led
+ on_value:
+ then:
+ - sensor.template.publish:
+ id: power_consumption
+ state: !lambda 'return x;'
+
+ # dont know what this does but it was commented out
+ internal_filter: 100ms
+
+ filters:
+ # Sensor can quickly transition between on and off (unintendet bevaior)
+ # this meter has max load of 13.27 kW (32A - 3 Phase - 240V) = pulse every 270ms at full load
+ - debounce: 100ms
+ # multiply value = (60 / imp value) * 1000
+ # - multiply: 60
+ # Clamp to physically possible max (13.3 kW) - if larger then drop the value
+ - lambda: |-
+ float watts = x * ((60.0 / id(select_pulse_rate).state) * 1000.0);
+ if (watts > 13300.0) return NAN;
+ return watts;
+
+ # Update the sensor with an average every 10th second. See
+ # https://github.com/klaasnicolaas/home-assistant-glow/#reduce-the-amount-of-data-the-sensors-produce
+ # for more information.
+ #- throttle_average: 10s
+
+ # filter out impossible numbers
+ - filter_out: NaN
+```
+
+### Kombinace spotřeby energie ze senzorů PulseMeter a DLMS/Cosem
+
+Vytvoříme senzor `template`, který kombinuje spotřebu energie ze senzorů PulseMeter a DLMS/Cosem. Pokaždé, když se kterýkoli ze senzorů aktualizuje, aktualizuje se i kombinovaný senzor.
+
+```yaml
+sensor:
+ - platform: template
+ id: power_consumption
+ name: "Power Consumption"
+ unit_of_measurement: 'W'
+ accuracy_decimals: 0
+ device_class: power
+ state_class: measurement
+ icon: mdi:flash
+
+ [... pulzní měřič z výše uvedeného configu ...]
+
+ - platform: xt211
+ id: active_power
+ name: "Active power consumption"
+ obis_code: 1.0.1.7.0.255
+ unit_of_measurement: W
+ accuracy_decimals: 0
+ device_class: power
+ state_class: measurement
+ on_value:
+ then:
+ - sensor.template.publish:
+ id: power_consumption
+ state: !lambda 'return x;'
+```
+
+## OBIS kódy ČEZ Distribuce XT211
+
+Úplný seznam OBIS kódů naleznete v dokumentu [vp_1-13.pdf](documents/vp_1-13.pdf) od ČEZ Distribuce.
+
+| OBIS kód | Hodnota | Popis |
+|-----------------|-----------------|---------------------------------------|
+| 0-0:96.1.1.255 | SN meter | Výrobní číslo elektroměru (Device ID) |
+| 0-0:96.3.10.255 | stav odpojovače | Indikace stavu odpojovače |
+| 0-0:17.0.0.255 | limiter | Hodnota pro limiter |
+| 0-1:96.3.10.255 | stav relé R1 | Stav relé R1 |
+| 0-2:96.3.10.255 | stav relé R2 | Stav relé R2 |
+| 0-3:96.3.10.255 | stav relé R3 | Stav relé R3 |
+| 0-4:96.3.10.255 | stav relé R4 | Stav relé R4 |
+| 0-0:96.14.0.255 | aktuální tarif | Aktuální tarif |
+| 1-0:1.7.0.255 | P+ | Okamžitý činný výkon odběru |
+| 1-0:21.7.0.255 | P+ L1 | Okamžitý činný výkon v L1 |
+| 1-0:41.7.0.255 | P+ L2 | Okamžitý činný výkon v L2 |
+| 1-0:61.7.0.255 | P+ L3 | Okamžitý činný výkon v L3 |
+| 1-0:2.7.0.255 | P- | Okamžitý činný výkon dodávky |
+| 1-0:22.7.0.255 | P- L1 | Okamžitý činný výkon v L1 |
+| 1-0:42.7.0.255 | P- L2 | Okamžitý činný výkon v L2 |
+| 1-0:62.7.0.255 | P- L3 | Okamžitý činný výkon v L3 |
+| 1-0:1.8.0.255 | A+ | Činná energie (+A) |
+| 1-0:1.8.1.255 | A+ T1 | Činná energie tarif 1 (+A) |
+| 1-0:1.8.2.255 | A+ T2 | Činná energie tarif 2 (+A) |
+| 1-0:1.8.3.255 | A+ T3 | Činná energie tarif 3 (+A) |
+| 1-0:1.8.4.255 | A+ T4 | Činná energie tarif 4 (+A) |
+| 1-0:2.8.0.255 | A- | Činná energie (-A) |
+
+
+# Finální setup
+
+Finální konfigurační soubor ESPHome naleznete zde: [esphome-smartmeter.yaml](esphome-smartmeter.yaml)
+
+
+
+
+
+Finální setup má:
+- Zařízení ESPHome s komponentou DLMS/Cosem
+- Převodník RS485 na TTL
+- Fotodiodový senzor LM393 pro PulseMeter
+- Namontované uvnitř projektové krabičky
+- Připojené k HAN portu WM-RelayBoxu
+- Připojené k Home Assistant přes integraci ESPHome
+- Activity LED pro indikaci detekce pulzu
+- Power LED pro indikaci stavu napájení
+- Napájení přes 5V napájecí zdroj (z USB napájecího adaptéru)
+
+## Poděkování
+- [latonita](https://github.com/latonita) - za původní komponentu esphome-dlms-cosem
+
diff --git a/README.md b/README.md
index 72bfd66..5923f13 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,356 @@
-# xt211
-ESPHome component for ČEZ Sagecom XT211 AMM
+# ESPHome DLMS/Cosem PUSH RS485 readout
+### For Sagecom XT211 smart meter used by ČEZ Distribuce (Czechia)
+### [[Česká verze]](README.cz.md)
+
+My electricity provider (ČEZ Distribuce) has just installed a new smart meter at my home. Up until this time I was using the [Home Assistant Glow](https://glow-energy.io/) to track my household energy consumption. So I was excited to finnaly get my hands on the new smart meter and see if I can read out the data from it. Unfortunately it was not as easy as I hoped, but after many failed attempts I managed to get it working, and I want to share my experience with you.
+
+## Sagecom XT211 - My smart meter
+
+[Distribution company website (in czech)](https://www.cezdistribuce.cz/pro-zakazniky/potrebuji-vyresit/elektromery-a-odecty/pruvodce-elektromery/xt211-amm) | [Datasheet](documents/Datasheet_Sagemcom_XT211_EN.pdf)
+
+
+
+The Sagecom XT211 is a three-phase smart meter that supports DLMS/COSEM protocol for data communication. It has a built-in RS485 interface that can be used to read out the meter data. The meter is configured for PUSH communication, which means it sends data every 60 seconds without the need for polling.
+
+
+
+In my case, the meters port was connected to the WM-RelayBox device, which is used for remote disconnection of the electricity supply. The RS485 interface is accessible via an RJ12 port that is located on the device.
+
+
+
+### WM-RelayBox
+
+[Datasheet](documents/WM-RelayBox__Datasheet_2024-ENG_v3.pdf) | [Installation Guide](documents/WM-Relay_Box__Installation_Guide_EN_V3_1.pdf) | [Quick Guide](documents/WM-RelayBox__Quick_Guide_V1_00.pdf)
+
+The RelayBox connects to the electricity meter (via its RJ12 E-Meter interface) and it receives unidirectional (one-way) DLMS / COSEM „push” commands and messages from the Head-end System through the meter.
+
+Then it executes the relay switch requests and sends all data provided by the smart meter to the Customer Interface HAN / P1 output interface (separate, isolated RJ12 port) of the RelayBox.
+
+
+
+### HAN port
+
+The HAN port is an isolated RJ12 port that provides access to the data sent by the electricity meter. The port uses RS485 communication with the following pinout:
+
+
+
+
+Some sources say that the 6th pin is connected to GND, while others say it is not used. I only have pins 3 and 4 connected, because I only need the data lines for RS485 communication (and I only had an RJ11 telephone cable that does not have pins 1 and 6).
+
+| Pin | Signal |
+|-----|-------------|
+| 1 | Not used |
+| 2 | Not used |
+| 3 | Data A (+) |
+| 4 | Data B (-) |
+| 5 | Not used |
+| 6 | GND |
+
+### RS485 to TTL converter
+
+To connect the HAN port to my ESPHome device, I used a RS485 to TTL converter. I used this AliExpress [ TTL To RS485](https://www.aliexpress.com/item/1005006828879851.html?spm=a2g0o.order_list.order_list_main.458.667a1802FPpBbB) module, but there are many other similar modules available.
+
+
+
+### RS485 parameters
+
+The RS485 communication parameters are defined in [připojovací podmínky NN](documents/pripojovacipodminkynn.pdf) document provided by ČEZ Distribuce:
+
+
+
+| Parameter | Value |
+|-----------------|----------|
+| Baud rate | 9600 bps |
+| Data bits | 8 |
+| Start bits | 0 |
+| Stop bits | 1 |
+| Parity | None |
+| Flow control | None |
+
+## PulseMeter (Home Assistant Glow)
+
+One thing I liked about the [Home Assistant Glow](https://glow-energy.io/) meter was that it updated fairly quickly (depending on the pulse frequency). The new meter sends PUSH messages only every 60 seconds, which is not ideal for real-time monitoring.
+
+So I decided to get the best of both worlds and use the PulseMeter in Home Assistant for real-time power consumption (W) monitoring, while using the ESPHome DLMS/Cosem readout for the energy (kWh) monitoring.
+
+For more information about the PulseMeter, see the [Home Assistant Glow documentation](https://glow-energy.io/).
+
+### LM393 Photo-diode sensor
+
+
+
+# Mounting
+
+I mounted the ESPHome device and the RS485 to TTL converter inside a small project box.
+
+### [Box.stl](3d print/Box.stl)
+
+
+I took the photodiode sensor box from the Home Assistant Glow meter.
+
+### [Sensor_bottom_side_v1.stl](3d print/Sensor_bottom_side_v1.stl)
+
+
+### [Sensor_top_side_v1.stl](3d print/Sensor_top_side_v1.stl)
+
+
+I made a Frame for mounting the sensor box on the XT211 meter.
+
+### [Frame XT211 Wide.stl](3d print/Frame XT211 Wide.stl)
+
+
+# Wiring diagram
+
+
+
+LM393 Photo-diode sensor:
+- VCC to 5V
+- GND to GND
+- DO (Digital Output) to GPIO6
+- AO (Analog Output) to GPIO5 (analog input, optional)
+
+RS485 to TTL converter:
+- VCC to 5V
+- GND to GND
+- TXD to RX (GPIO21)
+- RXD to TX (GPIO22)
+
+HAN port (RJ12 / RJ11):
+- B- (Data B) to HAN port pin 4
+- A+ (Data A) to HAN port pin 3
+- GND to pin 6 (optional)
+
+Activity LED (optional):
+- Anode (longer leg) to GPIO4 (with 220 ohm resistor in series)
+- Cathode (shorter leg) to GND
+
+Power Led (optional):
+- Anode (longer leg) to 5V (with 4700 ohm resistor in series - lower brightness)
+- Cathode (shorter leg) to GND
+
+# Custom ESPHome component
+
+To read out the DLMS/Cosem PUSH messages from the Sagecom XT211 meter, I modified the existing [esphome-dlms-cosem](https://github.com/latonita/esphome-dlms-cosem).
+
+Removed the polling functionality, fixed some bugs, and added support for binary sensors.
+
+For a more detailed description of the component, see the [esphome-dlms-cosem repository](https://github.com/latonita/esphome-dlms-cosem) from [latonita](https://github.com/latonita)
+
+## ESPHome configuration
+
+### For full configuration file, see: [esphome-smartmeter.yaml](esphome-smartmeter.yaml)
+
+Add the external component to your ESPHome configuration:
+
+```yaml
+
+external_components:
+ - source: github://Tomer27cz/xt211
+ components: [xt211]
+```
+Then configure the DLMS/Cosem component:
+- push_show_log: true (optional, for debugging purposes - shows all received PUSH messages in the log)
+
+Disable the log onece everything is working fine.
+
+```yaml
+uart:
+ id: bus_1
+ tx_pin: GPIO20
+ rx_pin: GPIO21
+ baud_rate: 9600
+ data_bits: 8
+ parity: NONE
+ stop_bits: 1
+
+xt211:
+ push_show_log: true
+```
+
+### Number sensor (`sensor`)
+My electricity consumption is measured in kWh, but the meter sends the value in Wh. Therefore, I use a lambda filter to convert the value from Wh to kWh by dividing it by 1000.
+
+```yaml
+sensor:
+ - platform: xt211
+ id: active_energy_consumed
+ name: "Energy"
+ obis_code: 1.0.1.8.0.255
+ unit_of_measurement: kWh
+ accuracy_decimals: 3
+ device_class: energy
+ state_class: total_increasing
+ filters:
+ - lambda: "return x/1000.0;"
+```
+
+### Binary sensor (`binary_sensor`)
+The binary sensor is `false` when the value is 0, and `true` when the value is anything else.
+
+```yaml
+binary_sensor:
+ - platform: xt211
+ name: "Relay 1"
+ obis_code: 0.1.96.3.10.255
+```
+
+### Text sensor (`text_sensor`)
+The text sensor is used to display string values sent by the meter.
+
+```yaml
+text_sensor:
+ - platform: xt211
+ name: "Serial number"
+ obis_code: 0.0.96.1.1.255
+ entity_category: diagnostic
+```
+
+### Pulse meter (`pulse_meter`) - for real-time power consumption monitoring (W)
+
+```yaml
+time:
+ - platform: homeassistant
+ id: homeassistant_time
+
+number:
+ - platform: template
+ id: select_pulse_rate
+ name: 'Puls rate - imp/kWh'
+ optimistic: true
+ mode: box
+ min_value: 100
+ max_value: 10000
+ step: 100
+ restore_value: yes
+ initial_value: 1000
+
+sensor:
+ - platform: pulse_meter
+ name: 'Pulse Power Consumption'
+ id: sensor_energy_pulse_meter
+ unit_of_measurement: 'W'
+ state_class: measurement
+ device_class: power
+ icon: mdi:flash-outline
+ accuracy_decimals: 0
+ pin: GPIO6
+
+ on_raw_value:
+ then:
+ - switch.turn_on: indicator_led
+ - delay: 100ms
+ - switch.turn_off: indicator_led
+ on_value:
+ then:
+ - sensor.template.publish:
+ id: power_consumption
+ state: !lambda 'return x;'
+
+ # dont know what this does but it was commented out
+ internal_filter: 100ms
+
+ filters:
+ # Sensor can quickly transition between on and off (unintendet bevaior)
+ # this meter has max load of 13.27 kW (32A - 3 Phase - 240V) = pulse every 270ms at full load
+ - debounce: 100ms
+ # multiply value = (60 / imp value) * 1000
+ # - multiply: 60
+ # Clamp to physically possible max (13.3 kW) - if larger then drop the value
+ - lambda: |-
+ float watts = x * ((60.0 / id(select_pulse_rate).state) * 1000.0);
+ if (watts > 13300.0) return NAN;
+ return watts;
+
+ # Update the sensor with an average every 10th second. See
+ # https://github.com/klaasnicolaas/home-assistant-glow/#reduce-the-amount-of-data-the-sensors-produce
+ # for more information.
+ #- throttle_average: 10s
+
+ # filter out impossible numbers
+ - filter_out: NaN
+```
+
+### Combine power consumption from PulseMeter and DLMS/Cosem sensors
+
+We create a template sensor that combines the power consumption from the PulseMeter and DLMS/Cosem sensors. Every time any of the sensors update, they also update the combined sensor.
+
+```yaml
+sensor:
+ - platform: template
+ id: power_consumption
+ name: "Power Consumption"
+ unit_of_measurement: 'W'
+ accuracy_decimals: 0
+ device_class: power
+ state_class: measurement
+ icon: mdi:flash
+
+ [... pulse meter from above ...]
+
+ - platform: xt211
+ id: active_power
+ name: "Active power consumption"
+ obis_code: 1.0.1.7.0.255
+ unit_of_measurement: W
+ accuracy_decimals: 0
+ device_class: power
+ state_class: measurement
+ on_value:
+ then:
+ - sensor.template.publish:
+ id: power_consumption
+ state: !lambda 'return x;'
+```
+
+## ČEZ Distribuce XT211 OBIS codes
+
+You can find the full list of OBIS codes in the [vp_1-13.pdf](documents/vp_1-13.pdf) document provided by ČEZ Distribuce.
+
+| OBIS Code | Value | Description |
+|-----------------|-----------------|---------------------------------------|
+| 0-0:96.1.1.255 | SN meter | Výrobní číslo elektroměru (Device ID) |
+| 0-0:96.3.10.255 | stav odpojovače | Indikace stavu odpojovače |
+| 0-0:17.0.0.255 | limiter | Hodnota pro limiter |
+| 0-1:96.3.10.255 | stav relé R1 | Stav relé R1 |
+| 0-2:96.3.10.255 | stav relé R2 | Stav relé R2 |
+| 0-3:96.3.10.255 | stav relé R3 | Stav relé R3 |
+| 0-4:96.3.10.255 | stav relé R4 | Stav relé R4 |
+| 0-0:96.14.0.255 | aktuální tarif | Aktuální tarif |
+| 1-0:1.7.0.255 | P+ | Okamžitý činný výkon odběru |
+| 1-0:21.7.0.255 | P+ L1 | Okamžitý činný výkon v L1 |
+| 1-0:41.7.0.255 | P+ L2 | Okamžitý činný výkon v L2 |
+| 1-0:61.7.0.255 | P+ L3 | Okamžitý činný výkon v L3 |
+| 1-0:2.7.0.255 | P- | Okamžitý činný výkon dodávky |
+| 1-0:22.7.0.255 | P- L1 | Okamžitý činný výkon v L1 |
+| 1-0:42.7.0.255 | P- L2 | Okamžitý činný výkon v L2 |
+| 1-0:62.7.0.255 | P- L3 | Okamžitý činný výkon v L3 |
+| 1-0:1.8.0.255 | A+ | Činná energie (+A) |
+| 1-0:1.8.1.255 | A+ T1 | Činná energie tarif 1 (+A) |
+| 1-0:1.8.2.255 | A+ T2 | Činná energie tarif 2 (+A) |
+| 1-0:1.8.3.255 | A+ T3 | Činná energie tarif 3 (+A) |
+| 1-0:1.8.4.255 | A+ T4 | Činná energie tarif 4 (+A) |
+| 1-0:2.8.0.255 | A- | Činná energie (-A) |
+
+
+# Final setup
+
+The final esphome configuration file can be found here: [esphome-smartmeter.yaml](esphome-smartmeter.yaml)
+
+
+
+
+
+The final setup includes:
+- ESPHome device with DLMS/Cosem component
+- RS485 to TTL converter
+- LM393 Photo-diode sensor for PulseMeter
+- Mounted inside a project box
+- Connected to the HAN port of the WM-RelayBox
+- Connected to Home Assistant via ESPHome integration
+- Activity LED to indicate pulse detection
+- Power LED to indicate power status
+- Powered via 5V power supply (from USB power adapter)
+
+## Credits
+- [latonita](https://github.com/latonita) - for the original esphome-dlms-cosem component
+
diff --git a/documents/Datasheet_Sagemcom_XT211_EN.pdf b/documents/Datasheet_Sagemcom_XT211_EN.pdf
new file mode 100644
index 0000000..4785417
Binary files /dev/null and b/documents/Datasheet_Sagemcom_XT211_EN.pdf differ
diff --git a/documents/WM-RelayBox__Datasheet_2024-ENG_v3.pdf b/documents/WM-RelayBox__Datasheet_2024-ENG_v3.pdf
new file mode 100644
index 0000000..d49a186
Binary files /dev/null and b/documents/WM-RelayBox__Datasheet_2024-ENG_v3.pdf differ
diff --git a/documents/WM-RelayBox__Quick_Guide_V1_00.pdf b/documents/WM-RelayBox__Quick_Guide_V1_00.pdf
new file mode 100644
index 0000000..0f16ff2
Binary files /dev/null and b/documents/WM-RelayBox__Quick_Guide_V1_00.pdf differ
diff --git a/documents/WM-Relay_Box__Installation_Guide_EN_V3_1.pdf b/documents/WM-Relay_Box__Installation_Guide_EN_V3_1.pdf
new file mode 100644
index 0000000..d19073f
Binary files /dev/null and b/documents/WM-Relay_Box__Installation_Guide_EN_V3_1.pdf differ
diff --git a/documents/ega_2025_3f-elektromeru-sagemcom-xt211.pdf b/documents/ega_2025_3f-elektromeru-sagemcom-xt211.pdf
new file mode 100644
index 0000000..ab4434d
Binary files /dev/null and b/documents/ega_2025_3f-elektromeru-sagemcom-xt211.pdf differ
diff --git a/documents/ega_2025_komunikacni_rozhrani_rs485.pdf b/documents/ega_2025_komunikacni_rozhrani_rs485.pdf
new file mode 100644
index 0000000..8ba1181
Binary files /dev/null and b/documents/ega_2025_komunikacni_rozhrani_rs485.pdf differ
diff --git a/documents/pripojovacipodminkynn.pdf b/documents/pripojovacipodminkynn.pdf
new file mode 100644
index 0000000..751a99c
--- /dev/null
+++ b/documents/pripojovacipodminkynn.pdf
@@ -0,0 +1,3055 @@
+%PDF-1.7
+%љ
+2 0 obj
+<<
+/Lang (cs)
+/MarkInfo <<
+/Marked true
+>>
+/Metadata 4 0 R
+/OutputIntents 5 0 R
+/Pages 6 0 R
+/StructTreeRoot 7 0 R
+/Type /Catalog
+/ViewerPreferences <<
+/Direction /L2R
+>>
+>>
+endobj
+4 0 obj
+<<
+/Length 14572
+/Subtype /XML
+/Type /Metadata
+>>
+stream
+
+
+
+
+ 2022-05-05T14:48:59+02:00
+ Adobe InDesign 14.0 (Windows)
+ 2019-08-06T09:56:47+01:00
+ 2025-01-31T13:08:28+01:00
+ 1
+ uuid:94e9721d-cd89-4159-b996-90e856a618d5
+ uuid:ea98602c-19db-44c9-85bb-0d452f82c1ea
+ proof:pdf
+
+ xmp.iid:f39363c6-c312-2249-81f4-93ba7979d227
+ xmp.did:f39363c6-c312-2249-81f4-93ba7979d227
+ 1
+ default
+
+
+
+
+ converted
+ from application/x-indesign to application/pdf
+ Adobe InDesign CC 14.0 (Windows)
+ 2019-08-06T10:56:47+02:00
+
+
+
+ application/pdf
+
+
+ Studio Marvil
+
+
+ Adobe PDF Library 15.0
+
+
+
+ http://ns.adobe.com/pdf/1.3/
+ pdf
+ Adobe PDF Schema
+
+
+
+ Producer
+ external
+ Text
+ The name of the tool that created the PDF document
+
+
+
+
+
+
+
+
+ http://ns.adobe.com/xap/1.0/
+ xmp
+ XMP Basic schema
+
+
+
+ MetadataDate
+ external
+ Date
+ The date and time that any metadata for this resource was last changed
+
+
+ CreatorTool
+ external
+ Text
+ The name of the first known tool used to create the resource
+
+
+ CreateDate
+ external
+ Date
+ The date and time the resource was originally created
+
+
+ ModifyDate
+ external
+ Date
+ The date and time the resource was last modified
+
+
+
+
+
+
+
+
+ http://ns.adobe.com/xap/1.0/mm/
+ xmpMM
+ XMP Media Management schema
+
+
+
+ VersionID
+ external
+ Text
+ The document version identifier for this resource
+
+
+ InstanceID
+ external
+ URI
+ An identifier for a specific incarnation of a document, updated each time a file is saved
+
+
+ DocumentID
+ external
+ URI
+ The common identifier for all versions and renditions of a document
+
+
+ RenditionClass
+ external
+ RenditionClass
+ The rendition class name for this resource
+
+
+ DerivedFrom
+ external
+ ResourceRef
+ A reference to the original document from which this one is derived.It is a minimal reference
+
+
+ History
+ external
+ seq ResourceEvent
+ An ordered array of high - level user actions that resulted in this resource
+
+
+
+
+
+
+ ResourceRef
+ http://ns.adobe.com/xap/1.0/sType/ResourceRef#
+ stRef
+ A reference to the original document from which this one is derived.It is a minimal reference
+
+
+
+ documentID
+ URI
+ The referenced resources XMP Media Management schema DocumentID
+
+
+ instanceID
+ URI
+ The referenced resources instance ID
+
+
+ renditionClass
+ RenditionClass
+ The referenced resources XMP Media Management schema RenditionClass
+
+
+ versionID
+ Text
+ The referenced resources XMP Media Management schema VersionID
+
+
+
+
+
+ seq ResourceEvent
+ http://ns.adobe.com/xap/1.0/sType/ResourceEvent#
+ stEvt
+ An ordered array of high - level user actions that resulted in this resource
+
+
+
+ action
+ Text
+ The action that occurred
+
+
+ parameters
+ Text
+ Additional description of the action
+
+
+ softwareAgent
+ AgentName
+ The software agent that performed the action
+
+
+ when
+ Date
+ Optional timestamp of when the action occurred
+
+
+
+
+
+
+
+
+ http://purl.org/dc/elements/1.1/
+ dc
+ Dublin Core schema
+
+
+
+ format
+ external
+ Text
+ The file format used when saving the resource. Tools and applications should set this property to the save format of the data
+
+
+ creator
+ external
+ seq ProperName
+ The authors of the resource
+
+
+
+
+
+
+
+
+
+ 2
+ B
+
+
+
+
+
+
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