So I’ve got a Particle powered doorbell which has been working reliably for ages now. It does more than monitor a single button, by the way, this isn’t IoT overkill!
Only yesterday for at least about half an hour, the doorbell wasn’t working. Leading to my wife getting complaints from her friends who were trying to gain access at the time! My wife of course passed on the complaints in full to me when I got home. I tried the doorbell and of course, it worked just fine! Arrg. So I didn’t THINK my code was dependent on either a WiFi Connection or a Cloud Connection but maybe it is?! Would you guys mind just checking over a couple of the salient bits of my code to advise if I’m labouring under a misapprehension? Otherwise (short of a loose connection) I’m really unsure what was going on.
SYSTEM_THREAD(ENABLED);
ButtonPressAction doorButton([]() {
if (Time.hour() >= 7 && Time.hour() <= 22) {
if (DoorBellPushed == 0 && dooropen == 0) {
Particle.publish(DEVICE_NAME, FDOOR_MSSG, 60, PRIVATE);
doorbellLED.on();
doorbelltimer.start();
DoorAnswered = 0;
DoorBellPushed = 1;
DoorSequence = 1;
Debounce12v = 1;
relayPin.on();
relaytimer.start();
relaydebouncetimer.start();
}
});
then in loop
ButtonPressAction::update();
obviously I can post the entire code if it’s desired, but it’s 500 lines and that’s without the libraries…
thank you if anyone has any pointers!! At this stage I’m thinking it might be preferable to go back to linking the doorbell push directly to bell and then somehow having a Photon safe “tap” off that circuit at logic level to let the Photon know the doorbell has been rung…