|
ESPHome 2026.10.0-dev
|
The write side of a ControllerDevice, owned by the writer entities through WriterEntity, whose forwarders re-expose exactly the request API a write lambda may use and record every dispatch. More...
#include <modbus_controller.h>
Public Member Functions | |
| bool | send_raw_frame_deprecated (std::span< const uint8_t > frame) |
| Send a legacy raw frame (address + function code + data) to the frame's own address. | |
| bool | dispatched () const |
| void | set_dispatched () |
| void | clear_dispatched () |
| void | warn_write_buffer_deprecated (const LogString *platform, uint16_t address) |
Warn once per entity that filling the write_lambda buffer parameter is deprecated (the entity is now the command - call a write helper / queue_pdu() on item instead). | |
Public Member Functions inherited from esphome::modbus_controller::ControllerDevice | |
| void | set_controller (ModbusController *controller) |
Protected Member Functions | |
| void | on_response (std::span< const uint8_t > request_pdu, std::span< const uint8_t > response_pdu) override |
| void | on_error (std::span< const uint8_t > request_pdu, modbus::ExceptionCode exception_code) override |
Protected Member Functions inherited from esphome::modbus_controller::ControllerDevice | |
| ControllerDevice ()=default | |
| ControllerDevice (ModbusController *controller) | |
| void | on_sent (std::span< const uint8_t > request_pdu) override |
| void | on_not_sent (std::span< const uint8_t > request_pdu) override |
| bool | on_no_response (std::span< const uint8_t > request_pdu) override |
| void | notify_online_ (std::span< const uint8_t > request_pdu) |
Protected Member Functions inherited from esphome::modbus::ModbusClientDevice | |
| ModbusClientDevice ()=default | |
| ModbusClientDevice (ModbusClientHub *parent, uint8_t address) | |
| virtual | ~ModbusClientDevice () |
| ModbusClientDevice (const ModbusClientDevice &)=delete | |
| ModbusClientDevice & | operator= (const ModbusClientDevice &)=delete |
| ModbusClientDevice (ModbusClientDevice &&)=delete | |
| ModbusClientDevice & | operator= (ModbusClientDevice &&)=delete |
| void | set_parent (ModbusClientHub *parent) |
| void | set_address (uint8_t address) |
| ESPDEPRECATED ("Override on_not_sent() instead. Removed in 2027.2.0", "2026.8.0") virtual void on_modbus_not_sent() | |
| ESPDEPRECATED ("Override on_no_response() instead. Removed in 2027.2.0", "2026.8.0") virtual bool on_modbus_no_response() | |
| virtual void | on_read_registers (EntityType entity_type, uint16_t start_address, std::span< const uint16_t > registers, ResponseStatus status) |
| High-level typed response callbacks, fired by the default on_response()/on_error() with arguments parsed from the request and response PDUs. | |
| virtual void | on_read_holding_registers (uint16_t start_address, std::span< const uint16_t > registers, ResponseStatus status) |
| virtual void | on_read_input_registers (uint16_t start_address, std::span< const uint16_t > registers, ResponseStatus status) |
| virtual void | on_read_bits (EntityType entity_type, uint16_t start_address, PackedBits bits, ResponseStatus status) |
| Coil/discrete-input reads are delivered as a PackedBits view (bit 0 = the bit at start_address, bits.size() = the count requested). | |
| virtual void | on_read_coils (uint16_t start_address, PackedBits bits, ResponseStatus status) |
| virtual void | on_read_discrete_inputs (uint16_t start_address, PackedBits bits, ResponseStatus status) |
| virtual void | on_write_single_register (uint16_t address, uint16_t value, ResponseStatus status) |
| Write acknowledgements. | |
| virtual void | on_write_single_coil (uint16_t address, bool value, ResponseStatus status) |
| virtual void | on_write_multiple_registers (uint16_t start_address, std::span< const uint16_t > registers, ResponseStatus status) |
| virtual void | on_write_multiple_coils (uint16_t start_address, PackedBits bits, ResponseStatus status) |
| virtual void | on_custom_response (std::span< const uint8_t > request_pdu, std::span< const uint8_t > response_pdu, ResponseStatus status) |
| Catch-all for custom function codes and anything that is not a standard-conformant transaction (see dispatch_response_()); on failure the response is empty and the exception code is in status. | |
| ESPDEPRECATED ("Use the typed read_*/write_* helpers or queue_pdu() instead. Removed in 2027.2.0", "2026.8.0") void send(uint8_t function | |
Additional Inherited Members | |
Protected Attributes inherited from esphome::modbus_controller::ControllerDevice | |
| bool | dispatched_ {false} |
| Write-path state owned by WriterEntity's forwarders, stored here so both bools land in the base's tail padding instead of adding a word to every writer entity. | |
| bool | write_buffer_deprecated_warned_ {false} |
| ModbusController * | controller_ {nullptr} |
Protected Attributes inherited from esphome::modbus::ModbusClientDevice | |
| uint16_t | start_address |
| uint16_t uint16_t | number_of_entities |
| uint16_t uint16_t uint8_t | payload_len = 0 |
| uint16_t uint16_t uint8_t const uint8_t * | payload |
| ModbusClientHub * | parent_ {nullptr} |
| uint8_t | address_ {0} |
| bool | custom_response_warned_ {false} |
The write side of a ControllerDevice, owned by the writer entities through WriterEntity, whose forwarders re-expose exactly the request API a write lambda may use and record every dispatch.
Definition at line 292 of file modbus_controller.h.
|
inline |
Definition at line 307 of file modbus_controller.h.
|
inline |
Definition at line 305 of file modbus_controller.h.
|
overrideprotectedvirtual |
Reimplemented from esphome::modbus_controller::ControllerDevice.
Definition at line 64 of file modbus_controller.cpp.
|
overrideprotectedvirtual |
Reimplemented from esphome::modbus_controller::ControllerDevice.
Definition at line 59 of file modbus_controller.cpp.
| bool esphome::modbus_controller::WriterDevice::send_raw_frame_deprecated | ( | std::span< const uint8_t > | frame | ) |
Send a legacy raw frame (address + function code + data) to the frame's own address.
Serves only the deprecated write_lambda buffer path. Remove before 2027.3.0.
Definition at line 24 of file modbus_controller.cpp.
|
inline |
Definition at line 306 of file modbus_controller.h.
| void esphome::modbus_controller::WriterDevice::warn_write_buffer_deprecated | ( | const LogString * | platform, |
| uint16_t | address ) |
Warn once per entity that filling the write_lambda buffer parameter is deprecated (the entity is now the command - call a write helper / queue_pdu() on item instead).
The buffer parameter is removed in 2027.3.0.
Definition at line 14 of file modbus_controller.cpp.