mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-04 03:48:29 +02:00
[modbus_controller] Add on_command_sent trigger (#7078)
Co-authored-by: Leo Schelvis <leo.schelvis@gmail.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/automation.h"
|
||||
#include "esphome/components/modbus_controller/modbus_controller.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace modbus_controller {
|
||||
|
||||
class ModbusCommandSentTrigger : public Trigger<int, int> {
|
||||
public:
|
||||
ModbusCommandSentTrigger(ModbusController *a_modbuscontroller) {
|
||||
a_modbuscontroller->add_on_command_sent_callback(
|
||||
[this](int function_code, int address) { this->trigger(function_code, address); });
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace modbus_controller
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user