39 lines
867 B
C++
39 lines
867 B
C++
#include <Homie.h> // https://github.com/marvinroger/homie-esp8266
|
|
|
|
#include "HardwareWitty.h"
|
|
//#include "HardwareWittyDht.h"
|
|
//#include "HardwareWittyDhtIrRxTx.h"
|
|
//#include "HardwareWittyBbq.h"
|
|
//#include "HardwareH801wifi.h"
|
|
//#include "HardwareSonoff.h"
|
|
|
|
const char* FWVERSION = "1.0.0";
|
|
|
|
void setupHandler() {
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
|
devices[i]->deviceSetup();
|
|
}
|
|
}
|
|
|
|
void loopHandler() {
|
|
hardwareLoop();
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
|
devices[i]->deviceLoop();
|
|
}
|
|
}
|
|
|
|
void setup() {
|
|
hardwareSetup();
|
|
Homie.setFirmware(FWNAME, FWVERSION);
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
|
devices[i]->deviceRegister();
|
|
}
|
|
Homie.setSetupFunction(setupHandler);
|
|
Homie.setLoopFunction(loopHandler);
|
|
Homie.setup();
|
|
}
|
|
|
|
void loop() {
|
|
Homie.loop();
|
|
}
|