diff --git a/alpaca/device.py b/alpaca/device.py index 6f1c910..a9d456a 100644 --- a/alpaca/device.py +++ b/alpaca/device.py @@ -15,7 +15,7 @@ CLIENT_TIMEOUT_SECONDS = 300 # 5 Minutes # Import from sibling modules -from .config import AlpacaConfig, get_current_time +from .config import AlpacaConfig, get_current_time, ALL_CLOUD_CONDITIONS # Assuming detect.py is in the root path or installed as a package from detect import CloudDetector, Config as DetectConfig, HADiscoveryManager @@ -230,6 +230,14 @@ def _run_single_detection(self, initial: bool = False): result = self.cloud_detector.detect(return_image=True) result['timestamp'] = get_current_time(self.alpaca_config.timezone) + # FIX: Normalize class name case to match configuration (Title Case preference) + # This handles cases where detection returns "mostly cloudy" but config expects "Mostly Cloudy" + raw_class = result.get('class_name', '') + for known_cond in ALL_CLOUD_CONDITIONS: + if known_cond.lower() == raw_class.lower(): + result['class_name'] = known_cond + break + # OPTIMIZATION: Convert to bytes immediately and drop the PIL Object image_bytes = None if 'image' in result: diff --git a/templates/setup.html b/templates/setup.html index c3b5ba4..ea85066 100644 --- a/templates/setup.html +++ b/templates/setup.html @@ -733,7 +733,7 @@

☁️ SimpleCloudDetect

- 🤖 + System Status