mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-03-20 09:18:39 +05:00
Compare commits
2 Commits
c0ff34f2e0
...
47bf122cff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47bf122cff | ||
|
|
5797a5c4c0 |
@@ -176,9 +176,10 @@ public:
|
||||
objId.c_str()
|
||||
);
|
||||
|
||||
// set device class, name, value template for bluetooth sensors
|
||||
// set device class, name, value template for Bluetooth/DHT sensors
|
||||
// or name & value template for another sensors
|
||||
if (sSensor.type == Sensors::Type::BLUETOOTH) {
|
||||
if (sSensor.type == Sensors::Type::BLUETOOTH ||
|
||||
sSensor.type == Sensors::Type::DHT11 || sSensor.type == Sensors::Type::DHT22) {
|
||||
// available state topic
|
||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = doc[FPSTR(HA_STATE_TOPIC)];
|
||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_SENSOR_CONN, true);
|
||||
|
||||
@@ -484,14 +484,11 @@ protected:
|
||||
this->dhtIsPolling = false;
|
||||
});
|
||||
|
||||
DHT::Type sType;
|
||||
DHT::Type sType = DHT::Type::DHT22;
|
||||
if (sSensor.type == Sensors::Type::DHT11) {
|
||||
sType = DHT::Type::DHT11;
|
||||
|
||||
} else if (sSensor.type == Sensors::Type::DHT11) {
|
||||
sType = DHT::Type::DHT22;
|
||||
|
||||
} else {
|
||||
} else if (sSensor.type == Sensors::Type::DHT22) {
|
||||
sType = DHT::Type::DHT22;
|
||||
}
|
||||
|
||||
@@ -499,7 +496,10 @@ protected:
|
||||
Log.sinfoln(FPSTR(L_SENSORS_DHT), F("Started on GPIO %hhu"), sSensor.gpio);
|
||||
|
||||
} else {
|
||||
Log.swarningln(FPSTR(L_SENSORS_DHT), F("Failed to start on GPIO %hhu"), sSensor.gpio);
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_DHT), F("Failed to start on GPIO %hhu (err: %s)"),
|
||||
sSensor.gpio, DHT::statusToString(this->dhtInstance.getStatus())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user