Hi Bruck,
What you are looking for is
ChipChop.removeStatus("motion_sensor");It's explained in the examples folder of the ChipChop library in the
all-functions.ino, pretty much covers exactly what you are looking for! 🙃
When you do a ChipChop.updateStatus() or ChipChop.triggerEvent() the library will remember the component you've specified and keep sending its status on every heartbeat even if it doesn't change
The ChipChop.removeStatus() removes a specific component from the status sending buffer until updateStatus() or triggerEvent() is called on that component again
Example:
void loop(){
// this is the point when you need to "mark" your motion sensor detection event
//this will happen instantly and will show in the app with the current timestamp
ChipChop.triggerEvent("motion_sensor","DETECTED");
//remove the "motion_sensor" from the heartbeat buffer immediately after the triggerEvent so the timestamp won't be overwritten on future heartbeats
ChipChop.removeStatus("motion_sensor");
}
That's pretty much all you have to do
Note:
This wouldn't work
void loop(){
ChipChop.updateStatus("motion_sensor","DETECTED");
ChipChop.removeStatus("motion_sensor");
}
The reason is that updateStatus() only tells the library to remember that particular component state but we don't know exactly when the library will send that status so calling removeStatus() would most likely cancel out the updateStatus()
That's why we need to use triggerEvent() as it bypasses the heartbeat cycle and is sent immediately guaranteeing that the status will be delivered and then we can safely use removeStatus() to stop future status updates until explicitly called again.
Hope this helps
tc
G ✌️