|
@ -71,6 +71,7 @@ struct __attribute__((packed)) sensor_readings_t { |
|
|
float temperature_max = NAN; // °C
|
|
|
float temperature_max = NAN; // °C
|
|
|
float temperature_min = NAN; // °C
|
|
|
float temperature_min = NAN; // °C
|
|
|
int battery = 0; |
|
|
int battery = 0; |
|
|
|
|
|
int8_t rssi = 0; |
|
|
uint32_t lastUpdate = 0; |
|
|
uint32_t lastUpdate = 0; |
|
|
} sensor_readings; |
|
|
} sensor_readings; |
|
|
|
|
|
|
|
@ -208,6 +209,7 @@ void getSensorMeasurements() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sensor_readings.battery = analogRead(_VBAT); |
|
|
sensor_readings.battery = analogRead(_VBAT); |
|
|
|
|
|
sensor_readings.rssi = WiFi.RSSI(); |
|
|
|
|
|
|
|
|
sensor_readings.lastUpdate = millis(); |
|
|
sensor_readings.lastUpdate = millis(); |
|
|
} |
|
|
} |
|
@ -488,6 +490,7 @@ void printValues() { |
|
|
Serial.println(sensor_readings.pm10); |
|
|
Serial.println(sensor_readings.pm10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Serial.print("RSSI: "); Serial.println(sensor_readings.rssi); |
|
|
Serial.print("Battery: "); Serial.println(sensor_readings.battery); |
|
|
Serial.print("Battery: "); Serial.println(sensor_readings.battery); |
|
|
|
|
|
|
|
|
Serial.print("Free HEAP: "); Serial.println(ESP.getFreeHeap()); |
|
|
Serial.print("Free HEAP: "); Serial.println(ESP.getFreeHeap()); |
|
@ -550,6 +553,12 @@ void sendValues() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
String topic_rssi = String("thomas/sensor/") + ota.getMAC() + String("/rssi"); |
|
|
|
|
|
mqtt.publish(topic_rssi.c_str(), sensor_readings.rssi, "%d"); |
|
|
|
|
|
delay(10); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|