From 1d26bbb9861731f83d734a6696a85fa295a25b0c Mon Sep 17 00:00:00 2001 From: Robin Thoni Date: Mon, 24 Jun 2024 08:29:09 +0000 Subject: [PATCH] added support for extended setUartOutput forms --- esphome/components/dfrobot_sen0395/commands.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/esphome/components/dfrobot_sen0395/commands.h b/esphome/components/dfrobot_sen0395/commands.h index cf3ba50be0..99a285818a 100644 --- a/esphome/components/dfrobot_sen0395/commands.h +++ b/esphome/components/dfrobot_sen0395/commands.h @@ -125,11 +125,14 @@ class LedModeCommand : public Command { class UartOutputCommand : public Command { public: UartOutputCommand(bool active) : active_(active) { - if (active) { - cmd_ = "setUartOutput 1 1"; - } else { - cmd_ = "setUartOutput 1 0"; - } + cmd_ = std::string("setUartOutput 1 ") + std::to_string((int) active); + }; + UartOutputCommand(int type, bool active) : active_(active) { + cmd_ = std::string("setUartOutput ") + std::to_string(type) + " " + std::to_string((int) active); + }; + UartOutputCommand(int type, bool active, bool auto_update, int interval) : active_(active) { + cmd_ = std::string("setUartOutput ") + std::to_string(type) + " " + std::to_string((int) active) + " " + + std::to_string((int) auto_update) + " " + std::to_string(interval); }; uint8_t on_message(std::string &message) override;