Skip to content

fix: weather parsing, if comparison, time display, room qualifier - #22

Merged
discostu105 merged 2 commits into
mainfrom
fix/bugs-weather-if-time
Mar 9, 2026
Merged

discostu105 merged 2 commits into
mainfrom
fix/bugs-weather-if-time

Conversation

@discostu105

Copy link
Copy Markdown
Owner

Bugs Fixed

Bug 1: lox weather — Completely broken output (Kritisch)

Root cause: get_bytes() was not checking the HTTP status code. When /data/weatheru.bin returns 404, the HTML error response was parsed as binary weather data, producing absurd values (temperature = 9.65e+199, year = 2067, etc.).
Fix: get_bytes() now checks the HTTP status and returns a clean error for non-200 responses.

Bug 2: lox if — Integer comparison fails

Root cause: eval_op used string equality for == and !=. So 200002700.000 == 200002700 was false.
Fix: eval_op now parses both sides as f64 for ==/!= comparisons, falling back to string comparison for non-numeric values.

Bug 3: lox if — [Room] qualifier not supported

Root cause: Cmd::If used find_control() which doesn't support the Name[Room] syntax.
Fix: Now uses resolve_with_room(), consistent with lox get and other commands.

Bug 4: lox if — Missing --room flag

All other control commands support --room for disambiguation. lox if was missing it.
Fix: Added --room flag to lox if.

Bug 5: lox time — Empty output

Root cause: Previous implementation queried wrong endpoints.
Fix: Now reads the Modified attribute from /data/status which is accessible to all users and contains the current Miniserver timestamp.


Also brings the full v0.2.1 feature set into the repo (the source was behind the installed binary: weather, time, globals, alias, dimmer, gate, color, thermostat, alarm, stats, history, music, reboot, files, extensions, discover commands).

Airwin and others added 2 commits March 9, 2026 06:42
- Bug 1: lox weather — get_bytes now checks HTTP status; returns clean
  error instead of parsing 404 HTML response as binary data (caused
  astronomically wrong values like temp=9.65e+199, year=2067)

- Bug 2: lox if — integer comparison now works: '200002700 == 200002700'
  correctly matches float value '200002700.000' by parsing both sides
  as f64 before comparing with ==

- Bug 3: lox if — [Room] qualifier in control name is now supported,
  consistent with 'lox get' and other commands

- Bug 4: lox if — added --room flag for disambiguation, consistent
  with all other control commands (get, on, off, info, etc.)

- Bug 5: lox time — now correctly reads 'Modified' attribute from
  /data/status endpoint; previously showed empty strings

Also brings codebase up to v0.2.1 feature set (weather, time, globals,
alias, dimmer, gate, color, thermostat, alarm, stats, history, music,
reboot, files, extensions, discover commands)
Resolve merge conflicts keeping all bug fixes from the PR branch
(weather parsing, if comparison, time display, room qualifier) while
incorporating main's wording improvements. Add test cases for numeric
string comparison edge cases (trailing zeros, large values).

https://claude.ai/code/session_01Y6FK5kGHrFBXHEQUWCjKHF
@discostu105
discostu105 merged commit 5e2082c into main Mar 9, 2026
2 checks passed
@discostu105
discostu105 deleted the fix/bugs-weather-if-time branch October 29, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants