Skip to content

Fix channel history for Vodafone Station and UltraHub7#211

Merged
itsDNNS merged 6 commits intomainfrom
fix/channel-history-type-mismatch
Mar 13, 2026
Merged

Fix channel history for Vodafone Station and UltraHub7#211
itsDNNS merged 6 commits intomainfrom
fix/channel-history-type-mismatch

Conversation

@itsDNNS
Copy link
Owner

@itsDNNS itsDNNS commented Mar 13, 2026

Summary

  • Fix channel history returning empty data for Vodafone Station (CGA/TG) and UltraHub7 modems
  • Show date-only labels in 30-day channel timeline views

Root cause

The Vodafone Station and UltraHub7 drivers return channelID as a string (e.g. "1") instead of an integer. The analyzer stored this as-is in the JSON, causing a type mismatch when get_channel_history() compared int(query_param) with the stored string - "1" == 1 is False in Python, so no data was ever returned.

Changes

  • analyzer.py: Cast channel_id to int when building channel dicts (prevents new string IDs)
  • storage/analysis.py: Cast stored channel_id to int during comparison (handles existing data in DB)
  • channels.js: Show date-only labels (MM-DD) for 30-day views in both timeline and compare modes
  • Added test for string channel ID matching

Test plan

  • 1553 tests pass, 0 failures
  • New test test_string_channel_id_matches verifies the fix

Closes #210

itsDNNS added 6 commits March 11, 2026 21:04
The Vodafone Station and UltraHub7 drivers return channelID as a string
(e.g. "1") instead of an integer. The analyzer stored this as-is, causing
a type mismatch in get_channel_history where int(query_param) != "1".

- Cast channel_id to int in analyzer when building channel dicts
- Handle string channel_ids in storage queries for existing data
- Show date-only labels (MM-DD) in 30d channel timeline/compare views
Address code review findings:
- CGA driver used str(parse_number()) producing "1.0" - int("1.0")
  raises ValueError, so channel history remained empty
- TG driver used str(ch.get("ChannelID", "")) which could be empty,
  crashing analyze() with ValueError

Fixes:
- Driver: return int channel IDs directly instead of str(float)
- Analyzer: add _parse_channel_id() with int(float()) and fallback to 0
- Storage: use int(float()) to handle existing "1.0" data in DB
- Tests: cover float-string IDs, empty channelID, multi-channel queries
@itsDNNS itsDNNS merged commit 78deb8b into main Mar 13, 2026
2 checks passed
@itsDNNS itsDNNS deleted the fix/channel-history-type-mismatch branch March 13, 2026 06: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.

No channel history available

1 participant