Add opt-in occupancy event publishing#371
Conversation
Adds a new opt-in feature that publishes occupancy state changes to the Particle cloud.
New Features:
- Toggle_Occupancy_Events console function to enable/disable (opt-in, default: disabled)
- Publishes 'Occupancy Changed' events when occupancy state changes:
- Occupied: State 0→1 and State 1→2
- Not occupied: State 2→0 and State 3→0
Event Payload:
{"occupied": "true/false", "state": "1/2/0", "door_status": "0x08", "INS_val": "15.3", "timestamp": "123456789"}
Data Usage:
- Only publishes on state changes (not periodic)
- ~80 bytes per event
- Typical usage: 2-4 events per bathroom session
- Minimal impact on data plan
Usage:
1. Call Toggle_Occupancy_Events with "1" to enable (persists to EEPROM)
2. Call with "0" to disable
3. Call with "e" to check current status
Firmware version bumped to 12028
bfcbfae to
3016a30
Compare
Phlashy
left a comment
There was a problem hiding this comment.
Can we double-check the data impact of this? Our Particle thresholds are quite restrictive and have super annoying burst pricing (?) where we end up on a more expensive tier forever if we burst through x MBs in a month. I can't recall what they are or where we're at, but I know that about 18 months ago we ended up bursting through it because we were accidentally leaving the dev environment on over the weekend which somehow blew through our entire budget. (Hence the Slack auto-reminder every week to turn it off.)
Johnny knows all the details.
|
Under the current plan, you could do 2,620/day per sensor. |
|
I think we need to look at our current usage and go from there. My question is about the total amount of data we're using, so we need to know our current baseline and see what capacity we have. Also, I don't fully understand how the capacity we have works but we've been burned before and they were willing to give us a free pass for that and ratchet us back down to the lower pricing tier. I don't think they'll do that again. |
This PR adds a new opt-in feature that publishes occupancy state changes to the Particle cloud, enabling real-time awareness of space usage via webhooks/streams.
New Features
Event Payload
{ "occupied": "true", "state": "2", "door_status": "0x08", "INS_val": "15.300000", "timestamp": "123456789" }Data Usage
Usage
Files Changed
Safety Considerations
Testing