Draft
Conversation
…storage - Create mqtt/history.rs with MqttHistoryStore for in-memory storage - Support weight readings history with pagination and time-based filtering - Support device status history tracking - Add automatic cleanup of old entries (configurable max age and max entries) - Implement thread-safe storage using RwLock for concurrent access - Add 7 unit tests for history module functionality - Fix outdated DeviceConfig tests in lib.rs to match new structure - Create coordination/backend-status.json for task tracking Task B1 completed. Co-authored-by: roostertk <roostertk@tutamail.com>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
B2: Integrate MqttHistoryStore with MQTT subscriber
- Add start_mqtt_subscriber_with_history() function
- Automatically store weight readings and device status from MQTT messages
- Subscribe to scaleit/weight/+ and scaleit/status/+ topics when history enabled
- Update AppState to hold optional history store reference
B3: Add REST API endpoints for MQTT history queries
- GET /api/mqtt/history/{device_id} - paginated weight readings history
- GET /api/mqtt/history/{device_id}/latest - most recent reading
- GET /api/mqtt/history/{device_id}/status - device status history
- GET /api/mqtt/history/{device_id}/stats - device statistics
- GET /api/mqtt/devices - list devices with history
- GET /api/mqtt/status - MQTT integration status
- DELETE /api/mqtt/history/{device_id} - clear device history
All 27 tests passing.
Co-authored-by: roostertk <roostertk@tutamail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add MQTT history module for storing weight readings and device status, and fix outdated
lib.rstests.The existing
lib.rstests were failing due to changes in theDeviceConfigstructure, which prevented the new history module tests from running successfully. These tests were updated to reflect the currentDeviceConfigstructure, ensuring a clean test run for the new module.