Closed NihilUnum closed 1 year ago
Hi Nihil,
since I switched from my own optical reader to Tibber Pulse, unfortunately I can not test it. This component didn't change since January. So my questions would be:
This could help to trace down the changes in ESPhome or this component...
PS: I found the OBIS Code also in the SML debug: 01:00:01:08:00:FF
, so the input to the SML component seems OK.
Regards, Daniel
Hi Daniel Thanks for such fast respond! I am very new in this area, it is my first attempt, I got already the ESPHome 2023.5.5 version. I got output one time and this was one week ago. Unfortunately it was only a test and I wanted configure my yaml file right. And that was where my misery started. Here is my compile log from today:
docker run --rm --privileged -v "${PWD}":/config -it esphome/esphome run sgm-c4_sml.yaml
INFO ESPHome 2023.5.5
INFO Reading configuration sgm-c4_sml.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing sgm-c4 (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/sgm-c4/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/api_frame_helper.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/api_pb2.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/api_pb2_service.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/api_server.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/list_entities.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/proto.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/subscribe_state.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/api/user_services.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/esp32/gpio.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/esp32/preferences.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/json/json_util.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/md5/md5.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/mdns/mdns_component.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/mdns/mdns_host.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/mdns/mdns_rp2040.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/network/util.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/ota/ota_backend_arduino_rp2040.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/ota/ota_component.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/sensor/automation.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/sensor/filter.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/sensor/sensor.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/sml/sensor/sml_sensor.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/sml/sml.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/socket/socket.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart_component.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart_component_esp32_arduino.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart_component_esp8266.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart_component_esp_idf.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart_component_rp2040.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/uart/uart_debugger.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/web_server/list_entities.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/web_server/web_server.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/web_server_base/web_server_base.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/wifi/wifi_component.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/wifi/wifi_component_esp32_arduino.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/wifi/wifi_component_esp_idf.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/components/wifi/wifi_component_pico_w.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/application.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/component.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/component_iterator.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/controller.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/entity_base.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/helpers.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/log.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/scheduler.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/string_ref.cpp.o
Compiling .pioenvs/sgm-c4/src/esphome/core/util.cpp.o
Compiling .pioenvs/sgm-c4/src/main.cpp.o
Linking .pioenvs/sgm-c4/firmware.elf
RAM: [= ] 12.4% (used 40548 bytes from 327680 bytes)
Flash: [===== ] 46.9% (used 860429 bytes from 1835008 bytes)
Building .pioenvs/sgm-c4/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/sgm-c4/firmware.bin"], [".pioenvs/sgm-c4/firmware.elf"])
Wrote 0xe37a0 bytes to file /config/.esphome/build/sgm-c4/.pioenvs/sgm-c4/firmware-factory.bin, ready to flash to offset 0x0
======================================================================= [SUCCESS] Took 25.83 seconds =======================================================================
*****************************************************************************************************************************************************************************
We found 1.03GB of unnecessary PlatformIO system data (temporary files, unnecessary packages, etc.).
Use `pio system prune --dry-run` to list them or `pio system prune` to save disk space.
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 (sgm-c4.local)
(number): 2
INFO Resolving IP address of sgm-c4.local
INFO -> 192.168.11.247
INFO Uploading .esphome/build/sgm-c4/.pioenvs/sgm-c4/firmware.bin (866208 bytes)
Uploading: [============================================================] 100% Done...
INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from sgm-c4.local using esphome API
INFO Successfully connected to sgm-c4.local
[20:27:14][I][app:102]: ESPHome version 2023.5.5 compiled on Jun 22 2023, 20:24:34
[20:27:14][C][wifi:505]: WiFi:
[20:27:14][C][wifi:363]: Local MAC: 94:E6:86:09:FF:FF
[20:27:14][C][wifi:364]: SSID: 'Weyland Yutani'
[20:27:15][C][wifi:365]: IP Address: 192.168.11.247
[20:27:15][C][wifi:367]: BSSID: 00:A0:F9:45:FF:FF
[20:27:15][C][wifi:368]: Hostname: 'sgm-c4'
[20:27:15][C][wifi:370]: Signal strength: -65 dB ▂▄▆█
[20:27:15][C][wifi:374]: Channel: 10
[20:27:15][C][wifi:375]: Subnet: 255.255.255.0
[20:27:15][C][wifi:376]: Gateway: 192.168.11.254
[20:27:15][C][wifi:377]: DNS1: 192.168.11.254
[20:27:15][C][wifi:378]: DNS2: 0.0.0.0
[20:27:15][C][logger:301]: Logger:
[20:27:15][C][logger:302]: Level: DEBUG
[20:27:15][C][logger:303]: Log Baud Rate: 115200
[20:27:15][C][logger:305]: Hardware UART: UART0
[20:27:15][C][uart.arduino_esp32:124]: UART Bus 1:
[20:27:15][C][uart.arduino_esp32:126]: RX Pin: GPIO23
[20:27:15][C][uart.arduino_esp32:128]: RX Buffer Size: 256
[20:27:15][C][uart.arduino_esp32:130]: Baud Rate: 9600 baud
[20:27:15][C][uart.arduino_esp32:131]: Data Bits: 8
[20:27:15][C][uart.arduino_esp32:132]: Parity: NONE
[20:27:15][C][uart.arduino_esp32:133]: Stop bits: 1
[20:27:15][C][sml_sensor:033]: SML 'Total energy'
[20:27:15][C][sml_sensor:033]: Device Class: 'energy'
[20:27:15][C][sml_sensor:033]: State Class: 'total_increasing'
[20:27:15][C][sml_sensor:033]: Unit of Measurement: 'kWh'
[20:27:15][C][sml_sensor:033]: Accuracy Decimals: 1
[20:27:15][C][sml_sensor:037]: OBIS Code: 1-0:1.8.0*255
[20:27:15][C][sml:091]: SML:
[20:27:15][C][captive_portal:088]: Captive Portal:
[20:27:15][C][web_server:151]: Web Server:
[20:27:15][C][web_server:152]: Address: sgm-c4.local:80
[20:27:15][C][mdns:108]: mDNS:
[20:27:15][C][mdns:109]: Hostname: sgm-c4
[20:27:15][C][ota:093]: Over-The-Air Updates:
[20:27:15][C][ota:094]: Address: sgm-c4.local:3232
[20:27:15][C][api:138]: API Server:
[20:27:15][C][api:139]: Address: sgm-c4.local:6053
[20:27:15][C][api:143]: Using noise encryption: NO
[20:32:03][I][ota:113]: Boot seems successful, resetting boot loop counter.
[20:32:04][D][esp32.preferences:114]: Saving 1 preferences to flash...
[20:32:04][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
Thanks for looking into
best Nihil
Hi Nihil,
I just remembered, that SML component is already included in ESPhome itself, maybe you should give it a try... https://esphome.io/components/sml.html?highlight=sml
I believe, it is tested way closer and following changes to ESPhome itself more quickly.
Could also be, that ESPhome SML and this SML component are conflicting somehow.
Regards, Daniel
Hi Daniel Just ESPHome was my first attempt, I also created a issue there (https://github.com/esphome/issues/issues/4584) but I got no respond. So I looked for solution and found this thread (https://github.com/esphome/feature-requests/issues/1041#issuecomment-1379847580). I tested yours SML version and from BMOD89. And it looks like I am not the only one with this problem. I tried to solve this by my self but I only know python, not C++. I did not figured how the parser works.
best Nihil
Hi Nihil,
for parsing, SML is a real pain, because it has recursive lists. I have a Tibber Pulse and the Tibber bridge. I "hacked" the bridge to access the SML message through HTTP. Here you can find my current progress: https://the78mole.de/doing-the-undone-decoding-sml-or-hacking-the-tibber-raw-data/
The blog post is not yet complete, but maybe it helps you a bit to understand that stuff and check the SML message.
Regards, Daniel
Hi Daniel
I will do this, thanks for you time.
best Nihil
Hi Alengwenus
I hope you can help me. I am fighting with my SGM-C4 electricity meter. Probably because it too new(?) I am getting great debug log
So I think hard ware is not a issue. I have a very simple yaml file (for testing):
The SML in ESPHome also does not work and now you are my last hope ;)
best Nihil