diff --git a/things/DeviceDht.h b/things/DeviceDht.h index a770993..a33c983 100644 --- a/things/DeviceDht.h +++ b/things/DeviceDht.h @@ -7,7 +7,7 @@ class DeviceDht : public Device { public: - inline DeviceDht(byte dhtPin, byte dhtType) { + inline DeviceDht(byte dhtPin, byte dhtType):dht(dhtPin, dhtType) { pin = dhtPin; type = dhtType; } @@ -17,9 +17,7 @@ class DeviceDht : public Device { private: byte pin; byte type; - // TODO configuration via constructor doesn't work yet - //DHT dht{pin, type}; - DHT dht{D4, DHT22}; + DHT dht; const int INTERVAL_DHT = 60; unsigned long lastSentDHT = 0; float humidity, temperature; // raw values from the sensor diff --git a/things/DeviceLdr.h b/things/DeviceLdr.h index 3b08adb..66cdf1d 100644 --- a/things/DeviceLdr.h +++ b/things/DeviceLdr.h @@ -17,7 +17,7 @@ class DeviceLdr : public Device { const int INTERVAL_LDR = 60; unsigned long lastSentLDR = 0; int ldr = 0; - HomieNode ldrNode{"ldr", "ldr"}; + HomieNode ldrNode = HomieNode("ldr", "ldr"); }; void DeviceLdr::setup() { diff --git a/things/DeviceLed.h b/things/DeviceLed.h index 15591a1..5b2a2d8 100644 --- a/things/DeviceLed.h +++ b/things/DeviceLed.h @@ -88,9 +88,8 @@ bool DeviceLed::ledColorHandler(String message) { } void DeviceLed::homieRegister() { - // TODO this doesn't work :-( - //ledNode.subscribe("on", &DeviceLed::ledOnHandler()); - //ledNode.subscribe("color", &DeviceLed::ledColorHandler()); + ledNode.subscribe("on", [this](String value) { return ledOnHandler(value); }); + ledNode.subscribe("color", std::bind(&DeviceLed::ledColorHandler, this, std::placeholders::_1)); Homie.registerNode(ledNode); }