esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

It does not decode SML anymore #4584

Closed NihilUnum closed 1 year ago

NihilUnum commented 1 year ago

The problem

Since couple of Days I can only see uart_debug messages but no SML.

Which version of ESPHome has the issue?

2023.5.5

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

2023.6.1

What platform are you using?

ESP32

Board

esp32dev (esp32-s)

Component causing the issue

I guess sml platform(?)

Example YAML snippet

esphome:
  name: sml

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: DEBUG
# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

wifi:
  ssid: ""
  password: ""

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sml Fallback Hotspot"
    password: ""

web_server:
  version: 1

captive_portal:

uart:
  id: uart_bus
  rx_pin: GPIO27
  baud_rate: 9600
  data_bits: 8
  parity: NONE
  stop_bits: 1
  debug:

sml:
  id: mysml
  uart_id: uart_bus

sensor:
  - platform: sml
    name: "SML Total energy"
    sml_id: mysml
    obis_code: "1-0:1.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    device_class: energy
    state_class: total_increasing
    filters:
      - multiply: 0.0001
      - throttle_average: 300s

  - platform: sml
    name: "SML Current Power"
    sml_id: mysml
    obis_code: "1-0:16.7.0"
    unit_of_measurement: W
    accuracy_decimals: 0
    device_class: power
    state_class: measurement
    on_value:
      then:
        - switch.turn_on: blueled

  - platform: sml
    name: "SML Current Voltage"
    sml_id: mysml
    obis_code: "1-0:32.7.0"
    unit_of_measurement: V
    accuracy_decimals: 1
    device_class: voltage
    state_class: measurement
    filters:
      - multiply: 0.1

  - platform: sml
    name: "SML Current Current"
    sml_id: mysml
    obis_code: "1-0:31.7.0"
    unit_of_measurement: A
    accuracy_decimals: 2
    device_class: current
    state_class: measurement
    filters:
      - multiply: 0.01

  - platform: sml
    name: "SML Current Frequency"
    sml_id: mysml
    obis_code: "1-0:14.7.0"
    unit_of_measurement: Hz
    accuracy_decimals: 3
    device_class: frequency
    state_class: measurement
    filters:
      - multiply: 0.1

switch:
  - platform: gpio
    pin: GPIO23
    id: blueled
    name: "SML Status LED"
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: blueled

Anything in the logs that might be useful for us?

mother@inuc:~$ docker run --rm -v "${PWD}":/config --device=/dev/ttyUSB0 -it esphome/esphome run sml.yaml
INFO ESPHome 2023.5.5
INFO Reading configuration sml.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing sml (board: esp32dev; framework: arduino; platform: platformio/espressif32@5.3.0)
----------------------------------------------------------------------------------------------------

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 1.2.2
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- AsyncTCP-esphome @ 1.2.2
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/sml/src/main.cpp.o
Linking .pioenvs/sml/firmware.elf
RAM:   [=         ]  12.4% (used 40628 bytes from 327680 bytes)
Flash: [=====     ]  47.5% (used 871161 bytes from 1835008 bytes)
Building .pioenvs/sml/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/sml/firmware.bin"], [".pioenvs/sml/firmware.elf"])
Wrote 0xe6180 bytes to file /config/.esphome/build/sml/.pioenvs/sml/firmware-factory.bin, ready to flash to offset 0x0
===================================================================================================================================================================================================== [SUCCESS] Took 10.54 seconds ====================================================================================================

****************************************************************************************************
INFO Successfully compiled program.
Found multiple options, please choose one:
  [1] /dev/ttyUSB0 (Sonoff Zigbee 3.0 USB Dongle Plus - Sonoff Zigbee 3.0 USB Dongle Plus)
  [2] Over The Air (sml.local)
(number): 2
INFO Resolving IP address of sml.local
INFO  -> 192.168.11.248
INFO Uploading .esphome/build/sml/.pioenvs/sml/firmware.bin (876928 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from sml.local using esphome API
INFO Successfully connected to sml.local
[16:46:26][I][app:102]: ESPHome version 2023.5.5 compiled on Jun 16 2023, 16:45:42
[16:46:26][C][wifi:505]: WiFi:
[16:46:26][C][wifi:363]:   Local MAC: 
[16:46:26][C][wifi:364]:   SSID: 
[16:46:26][C][wifi:365]:   IP Address: 192.168.11.248
[16:46:26][C][wifi:367]:   BSSID: 00:A0:F9:45:DD:28
[16:46:26][C][wifi:368]:   Hostname: 'sml'
[16:46:26][C][wifi:370]:   Signal strength: -76 dB ▂▄▆█
[16:46:26][C][wifi:374]:   Channel: 10
[16:46:26][C][wifi:375]:   Subnet: 255.255.255.0
[16:46:26][C][wifi:376]:   Gateway: 192.168.11.254
[16:46:26][C][wifi:377]:   DNS1: 192.168.11.254
[16:46:26][C][wifi:378]:   DNS2: 0.0.0.0
[16:46:26][C][logger:301]: Logger:
[16:46:26][C][logger:302]:   Level: DEBUG
[16:46:26][C][logger:303]:   Log Baud Rate: 115200
[16:46:26][C][logger:305]:   Hardware UART: UART0
[16:46:26][C][uart.arduino_esp32:124]: UART Bus 1:
[16:46:26][C][uart.arduino_esp32:126]:   RX Pin: GPIO27
[16:46:26][C][uart.arduino_esp32:128]:   RX Buffer Size: 256
[16:46:26][C][uart.arduino_esp32:130]:   Baud Rate: 9600 baud
[16:46:26][C][uart.arduino_esp32:131]:   Data Bits: 8
[16:46:26][C][uart.arduino_esp32:132]:   Parity: NONE
[16:46:26][C][uart.arduino_esp32:133]:   Stop bits: 1
[16:46:26][C][switch.gpio:068]: GPIO Switch 'SML Status LED'
[16:46:26][C][switch.gpio:091]:   Restore Mode: always OFF
[16:46:26][C][switch.gpio:031]:   Pin: GPIO23
[16:46:26][C][sml:091]: SML:
[16:46:26][C][sml_sensor:033]: SML 'SML Total energy'
[16:46:26][C][sml_sensor:033]:   Device Class: 'energy'
[16:46:26][C][sml_sensor:033]:   State Class: 'total_increasing'
[16:46:26][C][sml_sensor:033]:   Unit of Measurement: 'kWh'
[16:46:26][C][sml_sensor:033]:   Accuracy Decimals: 3
[16:46:26][C][sml_sensor:037]:   OBIS Code: 1-0:1.8.0
[16:46:26][C][sml_sensor:033]: SML 'SML Current Power'
[16:46:26][C][sml_sensor:033]:   Device Class: 'power'
[16:46:26][C][sml_sensor:033]:   State Class: 'measurement'
[16:46:26][C][sml_sensor:033]:   Unit of Measurement: 'W'
[16:46:26][C][sml_sensor:033]:   Accuracy Decimals: 0
[16:46:26][C][sml_sensor:037]:   OBIS Code: 1-0:16.7.0
[16:46:26][C][sml_sensor:033]: SML 'SML Current Voltage'
[16:46:26][C][sml_sensor:033]:   Device Class: 'voltage'
[16:46:26][C][sml_sensor:033]:   State Class: 'measurement'
[16:46:26][C][sml_sensor:033]:   Unit of Measurement: 'V'
[16:46:26][C][sml_sensor:033]:   Accuracy Decimals: 1
[16:46:26][C][sml_sensor:037]:   OBIS Code: 1-0:32.7.0
[16:46:26][C][sml_sensor:033]: SML 'SML Current Current'
[16:46:26][C][sml_sensor:033]:   Device Class: 'current'
[16:46:26][C][sml_sensor:033]:   State Class: 'measurement'
[16:46:26][C][sml_sensor:033]:   Unit of Measurement: 'A'
[16:46:26][C][sml_sensor:033]:   Accuracy Decimals: 2
[16:46:26][C][sml_sensor:037]:   OBIS Code: 1-0:31.7.0
[16:46:26][C][sml_sensor:033]: SML 'SML Current Frequency'
[16:46:26][C][sml_sensor:033]:   Device Class: 'frequency'
[16:46:26][C][sml_sensor:033]:   State Class: 'measurement'
[16:46:26][C][sml_sensor:033]:   Unit of Measurement: 'Hz'
[16:46:26][C][sml_sensor:033]:   Accuracy Decimals: 3
[16:46:26][C][sml_sensor:037]:   OBIS Code: 1-0:14.7.0
[16:46:26][C][captive_portal:088]: Captive Portal:
[16:46:26][C][web_server:151]: Web Server:
[16:46:26][C][web_server:152]:   Address: sml.local:80
[16:46:26][C][mdns:108]: mDNS:
[16:46:26][C][mdns:109]:   Hostname: sml
[16:46:26][C][ota:093]: Over-The-Air Updates:
[16:46:26][C][ota:094]:   Address: sml.local:3232
[16:46:26][C][api:138]: API Server:
[16:46:26][C][api:139]:   Address: sml.local:6053
[16:46:26][C][api:143]:   Using noise encryption: NO
[16:50:48][D][sensor:094]: 'SML Total energy': Sending state nan kWh with 3 decimals of accuracy
[16:51:15][I][ota:113]: Boot seems successful, resetting boot loop counter.
[16:51:15][D][esp32.preferences:114]: Saving 1 preferences to flash...
[16:51:15][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

[17:01:27][D][uart_debug:114]: <<< 09:1B:1B:1B:01:01:01:01:76:05:00:37:CE:D3:62:00:62:00:72:63:01:01:76:01:07:FF:FF:FF:FF:FF:FF:05:00:12:9A:47:0B:0A:01:45:46:52:21:02:CF:69:49:72:62:01:65:01:F7:EC:77:01:63:B6:7F:00:76:05:00:37:CE:D4:62:00:62:00:72:63:07:01:77:07:FF:FF:FF:FF:FF:FF:0B:0A:01:45:46:52:21:02:CF:69:49:07:01:00:62:0A:FF:FF:72:62:01:65:01:F7:EC:77:F1:06:77:07:01:00:60:32:01:01:01:01
[17:01:27][D][uart_debug:114]: <<< 01:01:04:45:46:52:01:77:07:01:00:60:01:00:FF:01:01:01:01:0B:0A:01:45:46:52:21:02:CF:69:49:01:77:07:01:00:01:08:00:FF:64:1C:50:04:72:62:01:65:01:F7:EC:77:62:1E:52:FF:65:02:66:F0:CA:01:77:07:01:00:02:08:00:FF:01:72:62:01:65:01:F7:EC:77:62:1E:52:FF:64:07:32:90:01:77:07:01:00:10:07:00:FF:01:01:62:1B:52:00:52:21:01:77:07:01:00:20:07:00:FF:01:01:62:23:52:FF:63:09:17:01:77:07:01:00:34:07:00:FF:01:01:62:23:52:FF:63:09:15:01:77:07:01:00:48:07:00:FF:01:01
[17:01:27][D][uart_debug:114]: <<< 62:23:52:FF:63:09:1C:01:77:07:01:00:1F:07:00:FF:01:01:62:21:52:FE:62:9A:01:77:07:01:00:33:07:00:FF:01:01:62:21:52:FE:62:8B:01:77:07:01:00:47:07:00:FF:01:01:62:21:52:FE:62:50:01:77:07:01:00:51:07:01:FF:01:01:62:08:52:00:53:00:F0:01:77:07:01:00:51:07:02:FF:01:01:62:08:52:00:52:79:01:77:07:01:00:51:07:04:FF:01:01:62:08:52:00:53:01:33:01:77:07:01:00:51:07:0F:FF:01:01:62:08:52:00:53:01:24:01:77:07:01:00:51:07:1A:FF:01:01:62:08:52:00:53:01:3F:01:77:07
[17:01:28][D][uart_debug:114]: <<< 01:00:0E:07:00:FF:01:01:62:2C:52:FF:63:01:F4:01:77:07:01:00:00:02:00:00:01:01:01:01:06:30:33:2E:30:30:01:77:07:01:00:60:5A:02:01:01:01:01:01:03:42:BD:01:77:07:01:00:61:61:00:00:01:01:01:01:03:00:00:01:77:07:01:00:60:32:01:04:01:01:01:01:08:50:31:2E:32:2E:31:32:01:77:07:01:00:60:32:04:04:01:01:01:01:03:04:22:01:01:01:63:1F:DA:00:76:05:00:37:CE:D5:62:00:62:00:72:63:02:01:71:01:63:36:3E:00:00:00:1B:1B:1B:1B:1A:02:08:D9
[17:01:28][D][uart_debug:114]: <<< 09:1B:1B:1B:01:01:01:01:76:05:00:37:CE:D6:62:00:62:00:72:63:01:01:76:01:07:FF:FF:FF:FF:FF:FF:05:00:12:9A:48:0B:0A:01:45:46:52:21:02:CF:69:49:72:62:01:65:01:F7:EC:78:01:63:CE:13:00:76:05:00:37:CE:D7:62:00:62:00:72:63:07:01:77:07:FF:FF:FF:FF:FF:FF:0B:0A:01:45:46:52:21:02:CF:69:49:07:01:00:62:0A:FF:FF:72:62:01:65:01:F7:EC:78:F1:06:77:07:01:00:60:32:01:01:01:01
[17:01:28][D][uart_debug:114]: <<< 01:01:04:45:46:52:01:77:07:01:00:60:01:00:FF:01:01:01:01:0B:0A:01:45:46:52:21:02:CF:69:49:01:77:07:01:00:01:08:00:FF:64:1C:58:04:72:62:01:65:01:F7:EC:78:62:1E:52:FF:65:02:66:F0:CA:01:77:07:01:00:02:08:00:FF:01:72:62:01:65:01:F7:EC:78:62:1E:52:FF:64:07:32:90:01:77:07:01:00:10:07:00:FF:01:01:62:1B:52:00:53:FF:5E:01:77:07:01:00:20:07:00:FF:01:01:62:23:52:FF:63:09:18:01:77:07:01:00:34:07:00:FF:01:01:62:23:52:FF:63:09:16:01:77:07:01:00:48:07:00:FF:01
[17:01:28][D][uart_debug:114]: <<< 01:62:23:52:FF:63:09:1B:01:77:07:01:00:1F:07:00:FF:01:01:62:21:52:FE:62:8E:01:77:07:01:00:33:07:00:FF:01:01:62:21:52:FE:62:88:01:77:07:01:00:47:07:00:FF:01:01:62:21:52:FE:62:55:01:77:07:01:00:51:07:01:FF:01:01:62:08:52:00:53:00:EE:01:77:07:01:00:51:07:02:FF:01:01:62:08:52:00:52:76:01:77:07:01:00:51:07:04:FF:01:01:62:08:52:00:53:01:04:01:77:07:01:00:51:07:0F:FF:01:01:62:08:52:00:53:01:07:01:77:07:01:00:51:07:1A:FF:01:01:62:08:52:00:53:00:FF:01:77

Additional information

This uard_debug looks actually right but I have no Idea why is he not decoding in SML I hope this is my issue, it should be easier to solve ;)

NihilUnum commented 1 year ago

I find out that 77:07:01:00:10:07:00:ff:01 is my "Actual Power". And it is in my uart_debug. So I get that Information, but I don't understand why I don't get this decoded.

NihilUnum commented 1 year ago

I will continue my monologue. It looks like my SGM-C4 bidirectional electricity meter got a new firmware(?) With uart_debug I am getting the right data (see http://www.schatenseite.de/2016/05/30/smart-message-language-stromzahler-auslesen/) Is it possible that ESPHome don't work with Ptotocol: SML EN 62056-22?

NihilUnum commented 1 year ago

Looks like I am not the only one https://github.com/esphome/feature-requests/issues/1041#issuecomment-1379847580

NihilUnum commented 1 year ago

No more necessary. Tasmota with MQQT did it with same hard ware, what ESPHome couldn’t.