Trouble migrating esp8266 Tasmota SML to ESPHome

I am trying to migrate an existing SML Setup from Tasmota to ESPHome.
So far no output from SML component but this is to be expected when reading the debug output from UART.

This is what I use in my esp8266 Tasmota Script:

+1,14,s,16,9600,SML1

So it is a SML input on GPIO14 with 9600 baud rate.

I tried to replicate the same in esphome

uart:
  - id: uart_bus1
    rx_pin: 
      number: GPIO14 # 
      inverted: false
    baud_rate: 9600
    data_bits: 8 
    parity: NONE
    stop_bits: 1
    debug:


sml:
  - id: sml1
    uart_id: uart_bus1

The ESPHome debug output looks very odd

[09:02:48.983][D][uart_debug:114]: <<< 12:12:12:12:00:00:00:00:64:00:00:1C:78:08:40:00:40:00:60:42:00:00:64:00:06:FE:FE:FE:FE:FE:FE:00:00:9E:7E:10:02:00:00:08:06:10:00:00:3C:72:00:60:40:00:40:00:9E:7E:32:00:42:30:06:00:64:00:00:1C:78:08:40:00:40:00:60:42:06:00:66:06:FE:FE:FE:FE:FE:FE:02:00:00:08:06:10:00:00:3C:72:00:06:00:00:40:00:FE:FE:60:40:00:40:00:9E:7E:32:60:66:06:00:00:40:20:00:00:00:00:00:00:00:08:06:10:00:66:06:00:00:40:00:00:FE:00:00:00:00:02:00:00:08:06:10:00:00:3C:72:00:00
[09:02:49.190][D][uart_debug:114]: <<< 66:06:00:00:00:00:00:FE:40:00:18:40:00:60:40:00:40:00:9E:7E:32:40:1C:00:FE:40:00:00:00:00:00:00:1C:1C:00:66:06:00:00:00:00:00:FE:00:60:40:00:40:00:9E:7E:32:40:1C:00:FE:40:00:00:00:00:00:80:20:00:00:66:06:00:00:00:06:00:FF:00:00:40:12:00:00:10:00:00:00:00:00:00:00:00:00:00:00:42:84:12:00:64:00:00:1C:78:0C:40:00:40:00:60:42:00:00:60:00:42:00:0C:00:00:00:12:12:12:12:10:00:F0:70

compared to the Tasmota (sensor53 d1)

16:49:18.859 : 77 07 01 00 60 32 01 01 01 01 01 01 04 4c 47 5a 01 
16:49:18.860 : 77 07 01 00 60 01 00 ff 01 01 01 01 0b 0a 01 4c 47 5a 00 04 3e 7b 01 01 
16:49:18.911 : 77 07 01 00 01 08 00 ff 65 00 1c 33 04 72 62 01 65 00 df fa c9 62 1e 52 ff 69 00 00 00 00 00 24 43 89 01 
16:49:18.961 : 77 07 01 00 02 08 00 ff 01 72 62 01 65 00 df fa c9 62 1e 52 ff 69 00 00 00 00 02 d2 b5 4b 01 
16:49:19.809 : 77 07 01 00 10 07 00 ff 01 01 62 1b 52 00 59 00 00 00 00 00 00 00 05 01 01 01 63 ee 60 00 76 05 02 9f ef f8 62 00 62 00 
16:49:19.811 : 77 07 ff ff ff ff ff ff 0b XX XX XX XX XX XX XX XX XX XX 07 01 00 62 0a ff ff 72 62 01 65 00 df fa ca 75 

I redacted the Meter Serial.

I tried inverting the UART port pin, only looks different after that:

12:10:18.625][D][uart_debug:114]: <<< 7F:23:27:7F:4D:82:2A:31:27:38:2B:00:4B:FE:FE:FE:F6:B6:27:19:7F:44:7C:7F:BE:E2:FE:02:7F:7F:27:72:2B:9A:FE:FE:FE:FE:FE:FE:FE:B6:FA:FA:FA:72:A6:0E:FC:26:EA:F6:82:F4:D2:76:FE:76:FE:36:72:F6:FA:3A:FA:72:82:2E:FE:FE:92:92:92:92:96:F6:36:3E:00
[12:10:19.475][D][uart_debug:114]: <<< 72:72:92:FA:FA:FA:26:F6:F4:CE:F2:B6:D2:D9:7C:00:00:00:00:00:00:FE:48:4E:3D:7F:5C:29:30:FD:D9:42:62:72:A2:0C:A4:3F:FD:CA:F2:F2:36:72:E2:FA:22:E2:02:04:20:00:7A:3D:7F:5C:29:30:FD:FA:FE:76:D6:02:00:23:27:7F:4D:82:2A:62:45:44:7C:7F:7E:36:FA:FA:FA:FA:FA:FA:EE:CE:E2:96:FA:22:E2:FA:FE:7E:FA:FE:02:7F:7F:7F:7F:7A:3D:7F:96:59:F9:EE:06:12:FA:FA:22:E2:FA:FE:FA:DE:FE:02:4D:8E:7A:EE:36:76:FA:6A:FE:82:2A:62:27:38:2B:00:4B:FE:FE:FE:FE:6E:FE:4E:7F:44:7C:7F:F6:DE
[12:10:19.623][D][uart_debug:114]: <<< FE:02:7F:23:27:7F:4D:82:2A:62:27:38:2B:00:4B:FE:FE:FE:F6:B6:27:19:7F:44:7C:7F:BE:E2:FE:02:7F:7F:27:72:2B:9A:FE:FE:FE:FE:FE:FE:FE:FE:FA:FA:FA:72:52:42:FC:26:EA:F6:82:F4:C6:76:FE:76:FE:36:72:F6:FA:3A:FA:72:92:CA:FE:FE:FE:92:92:92:92:96:F6:AA:00
[12:10:20.472][D][uart_debug:114]: <<< 92:92:FA:FA:FA:FA:26:EA:82:D9:F2:76:B6:D2:22:F1:02:02:02:EA:82:B1:D2:D6:FA:CE:E2:F9:EE:93:36:E9:F2:84:7F:62:96:FE:52:82:BE:76:FE:76:FE:92:12:FA:12:80:01:03:D8:D6:FA:CE:EF:9F:FF:E2:FE:76:D6:02:00:23:27:7F:4D:82:2A:98:91:24:FA:FE:7E:36:FA:FA:FA:FA:FA:FA:EE:CE:E2:96:FA:22:E2:FA:FE:7E:FA:FE:02:7F:7F:7F:7F:7A:3D:7F:96:59:F9:EE:06:12:FA:FA:22:E2:FA:FE:FA:DE:FE:02:4D:8E:5A:EE:36:76:FA:6A:FE:82:2A:98:27:38:2B:00:4B:FE:FE:FE:FE:6E:FE:4E:7F:44:7C:7F:F6:DE
[12:10:20.624][D][uart_debug:114]: <<< FE:02:7F:23:27:7F:4D:82:2A:98:27:38:2B:00:4B:FE:FE:FE:F6:B6:27:19:7F:44:7C:7F:BE:E2:FE:02:7F:7F:27:72:2B:9A:02:00:00:00:00:00:00:06:7F:7F:7F:4E:24:72:26:EA:F6:82:F4:BA:76:FE:76:FE:36:72:F6:FA:3A:FA:72:B6:7E:FE:FE:FE:92:92:92:92:96:F6:DA:33

Any ideas where I am doing a mistake here?
Would think the very same hardware should rule this out, but it is a different NodeMCU esp8266 module…

Are the defaults for the serial port ( like 9600 bits/sec, No Parity, 1 Stop bit different in Tasmota and ESPHome?.

I don’t think so. Esphome defaults to 8N1 and since you are using software serial (gpio14), I think other options are not even available.

Is your wiring rock solid?

I´d say it is. I can also see the esphome uart debug lines stopping when removing the IR diode ( reader head). They come back right after reattaching it.

I have a custom made pcb with a level shifter ic. For the test I take out a d1 mini esp8266 with tasmota and put in another one with esphome. The tasmota works until I take it out and right away when I put it back in.

I have no proper Logic Analyzer unfortunately. This would have been my next step…

Quick search gives that tasmota software serial is 8N1 only as well.
Did you try with hardware serial? GPIO13

Thanks for getting back. I might be missing something quite stupid…

I thought on the ESP8266 it is Software serial only. How is GPIO13 any different? I do not see anything special about it here

and then how would this make a difference with ESPHome but not for Tasmota.

It is a custom pcb, so switching is a bit more difficult but not impossible.

Maybe I am paying to much attention to the uart output?
But the screenshot in this blog Smart Meter Stromzähler auslesen mit Tasmota & ESPHome - Alkly does indicate that the uart debug should list the actual SML message. In his debug output I see the 77:07 that I would expect.

Esp8266 has hw serial RX on pin gpio3 as default which you can flip to gpio13.
Obviously just in case you don’t use Rx already for something else.

No idea. Sw serial is not so waterproof approach generally.

Solved:
Hardware Serial on Port GPIO3 (RX) worked in combination with deactivating logger (because it uses this port for the serial output).

logger:
  # level: VERBOSE
  baud_rate: 0

uart:
  - id: uart_bus1
    tx_pin: GPIO1 
    rx_pin: 
      #number: GPIO14 # 
      number: GPIO3
      inverted: false
    baud_rate: 9600
    data_bits: 8 
    parity: NONE
    stop_bits: 1
    debug:


sml:
  - id: sml1
    uart_id: uart_bus1

I did not manage to get GPIO13 to work in Hardware.

So it seems as if the Software UART implementation in Tasmota works a bit more robust than the one by ESPHome…

Again, thanks for the help!

That’s weird.
Some boards have problems with default RX/TX pins because of how they are connected to usb-serial, but swap to 13 should always work.