2016-04-22 22:45:45 +02:00
|
|
|
#include <Homie.h> // https://github.com/marvinroger/homie-esp8266
|
2016-03-30 21:08:18 +02:00
|
|
|
|
2016-05-18 08:53:58 +02:00
|
|
|
#include "HardwareWitty.h"
|
2016-05-18 09:42:06 +02:00
|
|
|
//#include "HardwareWittyDht.h"
|
2016-05-18 10:31:16 +02:00
|
|
|
//#include "HardwareWittyDhtIrRxTx.h"
|
2016-12-13 22:18:07 +01:00
|
|
|
//#include "HardwareWittyBbq.h"
|
2016-05-18 08:53:58 +02:00
|
|
|
//#include "HardwareH801wifi.h"
|
2016-12-13 23:47:54 +01:00
|
|
|
//#include "HardwareSonoff.h"
|
2016-04-10 23:54:05 +02:00
|
|
|
|
2016-05-18 09:04:10 +02:00
|
|
|
const char* FWVERSION = "1.0.0";
|
|
|
|
|
2016-03-30 21:08:18 +02:00
|
|
|
void setupHandler() {
|
2016-04-11 21:09:31 +02:00
|
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
2016-04-11 00:29:05 +02:00
|
|
|
devices[i]->deviceSetup();
|
2016-04-10 23:54:05 +02:00
|
|
|
}
|
2016-02-23 11:12:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-30 21:08:18 +02:00
|
|
|
void loopHandler() {
|
2016-04-11 21:09:31 +02:00
|
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
2016-04-11 00:29:05 +02:00
|
|
|
devices[i]->deviceLoop();
|
2016-04-10 23:54:05 +02:00
|
|
|
}
|
2016-02-24 07:43:01 +01:00
|
|
|
}
|
|
|
|
|
2016-02-23 11:12:04 +01:00
|
|
|
void setup() {
|
2016-05-21 19:19:24 +02:00
|
|
|
hardwareSetup();
|
2016-05-18 09:04:10 +02:00
|
|
|
Homie.setFirmware(FWNAME, FWVERSION);
|
2016-04-11 21:09:31 +02:00
|
|
|
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
2016-04-11 00:29:05 +02:00
|
|
|
devices[i]->deviceRegister();
|
2016-04-10 23:54:05 +02:00
|
|
|
}
|
2016-03-30 21:08:18 +02:00
|
|
|
Homie.setSetupFunction(setupHandler);
|
|
|
|
Homie.setLoopFunction(loopHandler);
|
|
|
|
Homie.setup();
|
2016-02-23 11:12:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2016-03-30 21:08:18 +02:00
|
|
|
Homie.loop();
|
2016-02-23 11:12:04 +01:00
|
|
|
}
|