This commit is contained in:
2024-05-23 21:24:52 +02:00
commit a3efe8274b
166 changed files with 15713 additions and 0 deletions

44
sonoff_dual_out.h Normal file
View File

@@ -0,0 +1,44 @@
#include "esphome.h"
using namespace esphome;
class SonoffOut1 : public Component, public switch_::Switch {
public:
void setup() override {
// This will be called by App.setup()
}
void write_state(bool state) override {
Serial.write(0xA0);
Serial.write(0x04);
if (state)
Serial.write(0x05);
else
Serial.write(0x00);
Serial.write(0xA1);
Serial.write('\n');
Serial.flush();
publish_state(state);
}
};
class SonoffOut2 : public Component, public switch_::Switch {
public:
void setup() override {
// This will be called by App.setup()
}
void write_state(bool state) override {
Serial.write(0xA0);
Serial.write(0x04);
if (state)
Serial.write(0x06);
else
Serial.write(0x00);
Serial.write(0xA1);
Serial.write('\n');
Serial.flush();
publish_state(state);
}
};