35 lines
768 B
C++
35 lines
768 B
C++
#include <Homie.h> // https://github.com/marvinroger/homie-esp8266
|
|
|
|
#include "HardwareWitty.h"
|
|
//#include "HardwareWittyDht.h"
|
|
//#include "HardwareWittyDhtIrRxTx.h"
|
|
//#include "HardwareH801wifi.h"
|
|
|
|
const char* FWVERSION = "1.0.0";
|
|
|
|
void setupHandler() {
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
|
devices[i]->deviceSetup();
|
|
}
|
|
}
|
|
|
|
void loopHandler() {
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
|
devices[i]->deviceLoop();
|
|
}
|
|
}
|
|
|
|
void setup() {
|
|
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();
|
|
}
|