Firmware flow
How readings become environmental flags
Selected sensor acquisition and state checks.
Read the motion input, update readings from sensors marked ready, and combine no-motion with valid numeric light or temperature values to set the two threshold flags.
The flags describe possible conditions, not measured energy savings. The excerpt does not clear old values when a sensor is unavailable or test reading freshness; cloud reporting is outside it.
Read the implementation
sensor acquisition / state flags excerpt · selected source lines 413–430. Source inspection is not a hardware test.
int pirRaw = digitalRead(PIR_PIN);
bool motionDetected = (pirRaw == LOW);
bool noMotion = !motionDetected;
if (bmeOK) {
temperatureC = bme.readTemperature();
humidity = bme.readHumidity();
pressureHpa = bme.readPressure() / 100.0F;
}
if (tslOK) {
sensors_event_t event;
tsl.getEvent(&event);
lux = event.light;
}
bool emptyRoomLightOn = noMotion && !isnan(lux) && lux > LIGHT_ON_THRESHOLD_LUX;
bool possibleHeatingWaste = noMotion && !isnan(temperatureC) && temperatureC > HIGH_TEMP_THRESHOLD_C;Open the exact source-level diagramTechnical notes
OLED feedback
showOLEDMessage() provides local display feedback alongside acquisition and remote logging.
Network and logging configuration
wifiDetailsAdded() and sheetsUrlAdded() identify two setup responsibilities: connecting the logger to a network and assigning its spreadsheet endpoint. This makes the destination part of the device configuration.
Spreadsheet records
The project includes a spreadsheet view with environmental columns and timestamped rows. This complements the local display: one presents device feedback, while the other organises reported data for later inspection.