Feature/sml raw data (#3326)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
micw 2023-11-05 22:38:09 +01:00 committed by GitHub
parent fbdf7f3d9c
commit 6635802e3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -47,6 +47,13 @@ smart meter. If you see checksum errors in the log try changing the interface pa
sml:
id: mysml
uart_id: uart_bus
on_data:
- lambda: !lambda |-
if (valid) {
id(mqttclient).publish("gridmeter/sensor/sml/state", format_hex(bytes));
} else {
id(mqttclient).publish("gridmeter/sensor/sml/error", format_hex(bytes));
}
sensor:
- platform: sml
@ -101,6 +108,21 @@ Text Sensor
- **format** (*Optional*, string): Override the automatic interpretation of the transmitted binary data value. Possible values (`int`, `uint`, `bool`, `hex`, `text`).
- All other options from :ref:`Text Sensor <config-text_sensor>`.
Automations:
------------
- **on_data** (*Optional*, :ref:`Automation <automation>`): An automation to perform when a
SML message is received. See :ref:`sml-on-data`.
.. _sml-on-data:
``on_data`` Trigger
********************
This automation will be triggered when a valid SML message is received. The variable ``bytes`` (of type
``std::vector<uint8_t>``) contains the raw sml data including start/end sequence. The variable ``valid``
(of type ``bool``) contains the result of the checksum verification.
Getting OBIS codes and sensor ids
---------------------------------