If it continues being an issue I'll see if there's anything I can do.
I know the accelometer can be configured in a bunch of different ways
so potentially it could be told to sleep until moved, avoiding waking
the Puck up.
Ah, thanks! I'll let you know how it goes. To be honest, that's kind of how I expected it to work. When setting up I was a bit shocked to see it take continuous readings. That's initially why I was trying take a single reading so I could mark roughly where I wanted the "action points". Ended up wrapping it straight into a conditional and tweaking the values.
I do use the counter approach: action and sensor counter. I advertise the light, temperature and battery every 1000ms and update every 5 minutes - as well as the readings themselves, it's just a useful heartbeat to make sure they're working OK.
When an action occurs: increment the action counter, set the action value, increase the interval to 20ms and set a timeout to revert back to 1000ms and set action to zero. The last point is the problem, and for the cat flap I have increased the amount of time it advertises the action at the faster interval before it resets to 0 to ensure a packet arrives!
I use the same code across all the Pucks I have: doorbell, our cat logger (single, long and double press for meal, snack and water replacement - so he doesn't get fed twice!), dinner is ready announcement button which plays to all rooms. The other half has a button to turn the kettle on so she can get ready for her shift while it boils, another which works in tandem with a motion sensor to enable a "shower mode" so the light doesn't go off. All kinds of silly little uses really!
I increase the interval time to account for the doorbell mainly; wanting an instant reaction. I reset the action ID because I burnt myself a few times when I was first creating the receiving script. I didn't account for the script restarting and an action being in place - the doorbell going off at silly o' clock was not great! Scared the s*** out of us!
Also a similar silly little bug led us to think the cat was pressing the button during the night as we were getting notifications that he was feeding himself! He knows the click it makes and knows he's being fed so we genuinally thought for a bit that he was getting creative - he's more of a dog in the body of a cat...
Anyway! Yes, I think I'm just about over the "doorbell incident", aha. I could remove that fail-safe now, and you're right it would definitely help.