Things/things/things.ino

38 lines
849 B
Arduino
Raw Normal View History

2016-04-22 22:45:45 +02:00
#include <Homie.h> // https://github.com/marvinroger/homie-esp8266
#include "HardwareWitty.h"
//#include "HardwareWittyDht.h"
//#include "HardwareWittyDhtIrRxTx.h"
2016-12-13 22:18:07 +01:00
//#include "HardwareWittyBbq.h"
//#include "HardwareH801wifi.h"
//#include "HardwareSonoff.h"
2016-04-10 23:54:05 +02:00
const char* FWVERSION = "1.0.0";
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
}
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() {
hardwareSetup();
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
}
Homie.setSetupFunction(setupHandler);
Homie.setLoopFunction(loopHandler);
Homie.setup();
2016-02-23 11:12:04 +01:00
}
void loop() {
Homie.loop();
2016-02-23 11:12:04 +01:00
}