From 81bbd19c091ff4b650d5dfbef83ccbf866d917c6 Mon Sep 17 00:00:00 2001 From: Tomer27cz Date: Sat, 7 Mar 2026 13:44:06 +0100 Subject: [PATCH] Enable UART pull-up Add explicit pull-up configuration for the UART RX pin and disable the logger (baud_rate: 0) to avoid pin conflicts with an RS485 converter. Updates applied to esphome-smartmeter.yaml and both README (EN/CZ) files with notes explaining that esp-idf > 5.x defaults pins to floating so RX needs pull-up, and that the logger was turned off because the same pins are shared with the RS485 converter. --- README.cz.md | 13 ++++++++++++- README.md | 13 ++++++++++++- esphome-smartmeter.yaml | 7 ++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/README.cz.md b/README.cz.md index d4f9e59..7edc3be 100644 --- a/README.cz.md +++ b/README.cz.md @@ -180,10 +180,17 @@ Konfigurační možnosti jsou: Až bude komponenta fungovat, můžeš nastavit `show_log` na `false`, aby se logy přestaly zobrazovat. ```yaml +logger: + baud_rate: 0 + uart: id: bus_1 + rx_pin: + number: GPIO21 + mode: + input: true + pullup: true tx_pin: GPIO20 - rx_pin: GPIO21 baud_rate: 9600 data_bits: 8 parity: NONE @@ -194,6 +201,10 @@ dlms_push: uart_id: bus_1 ``` +V novějších verzích ESPHome (esp-idf > 5.x) je potřeba pro piny `uart` nastavit pull-up, jinak komunikace nebude fungovat. Proto6e výchozí stav pinů byl změněn na "floating". + +Používám stejné piny pro RS485 převodník jako pro logger, takže jsem musel logger vypnout nastavením `baud_rate` na 0. Pokud chceš logger ponechat povolený, můžeš použít jiné piny pro logger. + ### 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. diff --git a/README.md b/README.md index 0a78931..80eb478 100644 --- a/README.md +++ b/README.md @@ -175,10 +175,17 @@ The configuration options are: Disable the log onece everything is working fine. ```yaml +logger: + baud_rate: 0 + uart: id: bus_1 + rx_pin: + number: GPIO21 + mode: + input: true + pullup: true tx_pin: GPIO20 - rx_pin: GPIO21 baud_rate: 9600 data_bits: 8 parity: NONE @@ -189,6 +196,10 @@ dlms_push: uart_id: bus_1 ``` +In newer versions of ESPHome (esp-idf > 5.x) , the `uart` pins need to be pulled up, otherwise the communication will not work. This is because the default state of the pins was changed to floating. + +I am using the same pins for the RS485 converter as for the logger, so I had to disable the logger by setting the `baud_rate` to 0. You can use different pins for the logger if you want to keep it enabled. + ### 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. diff --git a/esphome-smartmeter.yaml b/esphome-smartmeter.yaml index e94a71f..b8a96d7 100644 --- a/esphome-smartmeter.yaml +++ b/esphome-smartmeter.yaml @@ -11,6 +11,7 @@ esp32: # Enable logging logger: + baud_rate: 0 # Enable Home Assistant API api: @@ -34,7 +35,11 @@ dlms_push: uart: id: bus_1 - rx_pin: GPIO21 + rx_pin: + number: GPIO21 + mode: + input: true + pullup: true tx_pin: GPIO20 baud_rate: 9600 data_bits: 8