Mqtt discovery for ha (#323)
* MQTT discovery factoring * add DHT discovery * BME topic macro change * add sensors to ha discovery * correct a comment typo #327 * let the possibility at buildtime to don't publish service data * reduce string usage * change MQTT ONOFF actuator to ON OFF commands instead of true false * add ZactuatorONOFF discovery * add simple publishing for GPIO input * Add RF switch and gateway discovery
This commit is contained in:
1 parent
ed44418a7f
commit
133e9cd33a
21 files changed
+442
-201
No files matched your search
+4
-4
@@ -37,12 +37,12 @@ unsigned long timeadc = 0;
|
||||
|
||||
void MeasureADC(){
|
||||
if (millis() > (timeadc + TimeBetweenReadingADC)) {//retriving value of temperature and humidity of the box from DHT every xUL
|
||||
#if defined(ESP8266)
|
||||
yield();
|
||||
#endif
|
||||
timeadc = millis();
|
||||
static int persistedadc;
|
||||
int val = analogRead(ADC_PIN);
|
||||
#if defined(ESP8266) || defined(ESP32)
|
||||
yield();
|
||||
#endif
|
||||
if (isnan(val)) {
|
||||
trc(F("Failed to read from ADC !"));
|
||||
}else{
|
||||
@@ -51,7 +51,7 @@ void MeasureADC(){
|
||||
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
|
||||
JsonObject& ADCdata = jsonBuffer.createObject();
|
||||
ADCdata.set("adc", (int)val);
|
||||
pub(ADC,ADCdata);
|
||||
pub(ADCTOPIC,ADCdata);
|
||||
persistedadc = val;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user