Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion alpaca/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion templates/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ <h1>☁️ Simple<span class="highlight">Cloud</span>Detect</h1>
<div class="section">
<div class="section-header" style="justify-content: space-between;">
<div style="display: flex; align-items: center; gap: 10px;">
<span class="icon">🤖</span>
<span class="icon"></span>
<span>System <span class="highlight">Status</span></span>
</div>
<div style="font-size: 14px; font-weight: 400; color: rgb(148, 163, 184); font-family: 'JetBrains Mono', monospace; text-shadow: none; letter-spacing: 0;">
Expand Down