issues - most likely caused by light setting

This commit is contained in:
2026-01-11 19:13:48 -06:00
parent 5ccd15dde3
commit 7a493759ba

View File

@@ -98,7 +98,7 @@ void setup() {
const int millisPerSecond=1000;
long previousMotionMillis=millis();
short previousState=0;
short previousState=-1;
long previousNoMoNotifyMinutes=0;
void loop() {
@@ -108,6 +108,9 @@ void loop() {
mqttClient.loop();
short currentState = digitalRead(PIR_PIN);
// This out pin triggering is dependent not only on movement, but also on light levels which can be configured in the app.
// I set it to 255 and "below" - this triggered it for me.....
//send_mqtt("occupancy_state_debug", currentState);
if (currentState != previousState) {
Serial.print("Status changed; currentState: ");
Serial.print(currentState);
@@ -118,6 +121,7 @@ void loop() {
digitalWrite(LED_BUILTIN,HIGH);
previousMotionMillis=millis();
} else {
send_mqtt("no_motion_ignore");
digitalWrite(LED_BUILTIN,LOW);
}
previousState = currentState;
@@ -130,5 +134,5 @@ void loop() {
previousNoMoNotifyMinutes = minutesSinceLastMotion;
}
delay(20);
delay(100);
}