Commit Graph

26 Commits

Author SHA1 Message Date
marcus cbec68ccd8 Update MQTT client to use MQTTv5 and fix callback arguments
- Updated MQTT client to use MQTTv5 to eliminate deprecated usage.
- Corrected on_connect function signature and replaced deprecated `rc` with `reasonCode` for compatibility.
2024-10-20 18:17:46 +11:00
marcus 41248a2f2b Fix MQTT client configuration and callback to resolve breaking issues
- Reverted MQTT client to MQTTv311 to avoid compatibility issues.
- Updated on_connect method to match expected arguments for MQTTv5.
- Fixed deprecation and runtime errors for proper operation.
2024-10-20 18:15:08 +11:00
marcus 1b6c07376a Fix MQTT client configuration and add image analysis improvements
- Updated MQTT client to use MQTTv5 without deprecated `clean_session` to resolve ValueError.
- Fine-tuned color thresholds for better dayglo detection accuracy.
- Added cropping to focus analysis on the central area of the image for improved rating calculation.
- Provided command-line option for analyzing specific images, enabling debugging and fine-tuning.
2024-10-20 18:12:12 +11:00
marcus 994e814823 Fix deprecated MQTT client usage and enhance dayglo detection
- Updated MQTT client to use MQTTv5 to resolve deprecation warning.
- Fine-tuned color thresholds for dayglo detection.
- Added cropping to focus on the center 80% of the image for more accurate analysis.
- Improved functionality to process an image provided via command line before continuing with MQTT message handling.
2024-10-20 18:09:59 +11:00
marcus 53807d79c1 Add command-line image processing option and fix deprecated MQTT client usage
- Removed deprecated MQTTv311 protocol usage.
- Added functionality to process an image provided via command line.
- Retained MQTT handling for normal message flow.
2024-10-20 18:01:31 +11:00
marcus df5e959ff4 Add mechanism to request a fresh snapshot upon connecting
- Added a function to request a fresh snapshot from Frigate or similar system upon connecting.
- Removed client disconnection to allow continued listening for snapshot messages.
2024-10-20 17:55:05 +11:00
marcus 9e84d2aa75 Retrieve retained MQTT snapshot and disconnect after receiving
- Modified the script to disconnect after receiving the retained snapshot message.
- Simplified MQTT loop handling to ensure reliable retrieval of retained messages.
2024-10-20 17:52:41 +11:00
marcus 892b7507c8 Adjust MQTT connection to improve retained message handling
- Removed unnecessary empty publish request to prevent interference.
- Added a delay after connection to allow time for retained messages to be received.
2024-10-20 17:48:46 +11:00
marcus 1200f7302b Attempt to fetch retained snapshot upon connection
- Added logic to explicitly request the retained snapshot message after MQTT connection.
- Enhanced debugging to understand why the payload is empty.
2024-10-20 17:38:48 +11:00
marcus 17be02c9f7 Improve snapshot payload debugging and handling
- Added a check for payload length and print debugging information.
- Print part of the payload to help diagnose issues with image data.
2024-10-20 17:36:56 +11:00
marcus e9e5ffb931 Improve snapshot handling to support different image formats
- Save snapshot as a temporary file before decoding, allowing better handling of JFIF or non-standard JPEG formats.
- Improved error handling for invalid or corrupted image data.
2024-10-20 17:35:04 +11:00
marcus 043e56e6f7 Fetch existing retained snapshot upon initial connection
- Added logic to request the retained snapshot message upon MQTT connection.
- Ensure initial snapshot is processed after connecting to the MQTT broker.
- Improved debugging logs for better traceability.
2024-10-20 17:28:56 +11:00
marcus 121673fde1 oops ... doubled up 2024-10-20 17:23:13 +11:00
marcus 0c21de1a73 Improve MQTT handling and add detailed logging
- Replaced blocking MQTT loop with non-blocking `loop_start()`.
- Enabled MQTT client logging to get detailed logs for debugging.
- Added debugging print statements to verify successful subscription.
2024-10-20 16:39:50 +11:00
marcus f74e8fc632 Simplify snapshot handling and improve debug logging
- Removed redundant `process_latest_snapshot()` function.
- Directly process snapshots from MQTT messages upon receiving.
- Added improved logging to help with debugging snapshot processing issues.
2024-10-20 16:35:19 +11:00
marcus be63a43613 Handle fetching latest snapshot from MQTT topic upon connection
- Added `get_latest_snapshot()` function to subscribe to the MQTT topic for the latest snapshot image.
- Updated `process_latest_snapshot()` to utilize the `get_latest_snapshot()` function.
- Improved the logging to provide better information about snapshot subscription status.
2024-10-20 16:31:57 +11:00
marcus fe25895b38 Better handling of payloads 2024-10-20 16:26:50 +11:00
marcus 05c9b1f713 improve 2024-10-20 16:25:27 +11:00
marcus 4801f4c56a Assess image at startup and add debug 2024-10-20 16:10:02 +11:00
marcus 8c21481f6e Move to ChatGPT canvas for improvements 2024-10-20 16:01:20 +11:00
marcus f5dee30509 improve debug 2024-10-20 15:55:45 +11:00
marcus 3fd01f4551 Improve 2024-10-20 14:04:42 +11:00
marcus ca8ff5c58d MQTT debug 2024-10-20 14:04:13 +11:00
marcus 72c69be09f setup MQTT topics for Home Assistant 2024-10-20 13:54:44 +11:00
marcus 227115a1c8 increase debug and assess at startyup 2024-10-20 13:24:51 +11:00
marcus b5255e4996 0.14.1 initial dayglo 2024-10-20 13:05:00 +11:00