issues - most likely caused by light setting
This commit is contained in:
@@ -98,7 +98,7 @@ void setup() {
|
|||||||
|
|
||||||
const int millisPerSecond=1000;
|
const int millisPerSecond=1000;
|
||||||
long previousMotionMillis=millis();
|
long previousMotionMillis=millis();
|
||||||
short previousState=0;
|
short previousState=-1;
|
||||||
long previousNoMoNotifyMinutes=0;
|
long previousNoMoNotifyMinutes=0;
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
@@ -108,6 +108,9 @@ void loop() {
|
|||||||
mqttClient.loop();
|
mqttClient.loop();
|
||||||
|
|
||||||
short currentState = digitalRead(PIR_PIN);
|
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) {
|
if (currentState != previousState) {
|
||||||
Serial.print("Status changed; currentState: ");
|
Serial.print("Status changed; currentState: ");
|
||||||
Serial.print(currentState);
|
Serial.print(currentState);
|
||||||
@@ -118,6 +121,7 @@ void loop() {
|
|||||||
digitalWrite(LED_BUILTIN,HIGH);
|
digitalWrite(LED_BUILTIN,HIGH);
|
||||||
previousMotionMillis=millis();
|
previousMotionMillis=millis();
|
||||||
} else {
|
} else {
|
||||||
|
send_mqtt("no_motion_ignore");
|
||||||
digitalWrite(LED_BUILTIN,LOW);
|
digitalWrite(LED_BUILTIN,LOW);
|
||||||
}
|
}
|
||||||
previousState = currentState;
|
previousState = currentState;
|
||||||
@@ -130,5 +134,5 @@ void loop() {
|
|||||||
previousNoMoNotifyMinutes = minutesSinceLastMotion;
|
previousNoMoNotifyMinutes = minutesSinceLastMotion;
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(20);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user