Commit Graph

6 Commits (6240f5455fa21d805f20044434a5e54b5a2501f5)

Author SHA1 Message Date
Tomer27cz 6240f5455f add dump raw option 2026-03-19 18:44:50 +01:00
Tomer27cz c9bbbd574c line length limit 2026-03-07 21:14:45 +01:00
Tomer27cz a9e13b6e8c Optimize DlmsParser allocations and types
Use stack buffers and C-strings to avoid heap allocations, and modernize token handling and ownership.

- Replace heap-allocated std::string temporaries in dlms_parser.cpp with stack buffers and pass const char* to callbacks/logs to reduce allocations and copying.
- Change DlmsDataCallback signature to accept const char* for obis and string values; update DlmsPushComponent to match.
- Switch DlmsParser ownership to std::unique_ptr in DlmsPushComponent and add <memory> include.
- Replace std::list with std::vector for DSL token parsing, update iteration/insertion logic accordingly.
- Remove unused <list> include and adjust related function signatures/whitespace.

These changes improve performance and memory usage; note the callback/API signature change may require updating any external callers.
2026-03-07 20:58:19 +01:00
Tomer27cz 789611a611 Make DLMS string helpers write to buffer
Change DlmsParser::data_to_string_ and obis_to_string_ signatures to return void and write into the provided caller buffer instead of returning std::string (avoids allocations and clarifies ownership).

Also add #include "esphome/core/application.h" in dlms_push.cpp for required declarations.
2026-03-07 20:39:57 +01:00
Tomer27cz 8fc10fb496 Optimize DLMS parser buffers and RX timing
Replace heavy std::string/iostream usage in the DLMS parser with stack-allocated char buffers and snprintf to avoid heap allocations and reduce runtime overhead. Introduce buffer-based helpers (data_to_string_, obis_to_string_) and switch hex formatting to format_hex_pretty_to; remove <sstream>/<iomanip> and include <cstdio>. Update header signatures accordingly. Also change DlmsPushComponent to use App.get_loop_component_start_time() instead of millis() when tracking last_rx_char_time_ for RX timeout handling.

Files changed: components/dlms_push/dlms_parser.cpp/.h (buffer-based string helpers, logging, include changes), components/dlms_push/dlms_push.cpp (use App loop time for timeout).

Note: The string helper APIs were converted to buffer-oriented versions — update any callers to provide an output buffer.
2026-03-07 20:33:20 +01:00
Tomer27cz 1db8e48acf new dlms_push component
dlms_push is a complete rewrite of the component using common esphome structure. The new component no longer uses Gurux library so it is significantly smaller and easier to maintain.

Update README (EN/CZ) to document dlms_push, replace xt211 examples, and expose new config options (show_log, receive_timeout, custom_pattern).

Also update esphome-smartmeter.yaml accordingly.
2026-03-07 13:06:16 +01:00