Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added heartbeat at each frame prediction #59

Merged
merged 2 commits into from
Jul 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pyroengine/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def predict(self, frame, pi_zero_id=None):
if pi_zero_id is None:
logging.info(f"Wildfire detection score ({res:.2%})")
else:
self.heartbeat(pi_zero_id)
logging.info(f"Wildfire detection score ({res:.2%}), on device {pi_zero_id}")

if res > self.detection_threshold:
Expand Down Expand Up @@ -138,3 +139,7 @@ def save_frame(self, pi_zero_id):
media_id = self.api_client[pi_zero_id].create_media_from_device().json()["id"]
# Send media
self.api_client[pi_zero_id].upload_media(media_id=media_id, media_data=self.stream.getvalue())

def heartbeat(self, pi_zero_id):
"""Updates last ping of device"""
self.api_client[pi_zero_id].heartbeat()