Skip to content

fix(media_player): parse real OWNSoundEvent dimensions and handle malformed RDS frames - #497

Merged
GreenGrassBlueOcean merged 1 commit into
OpenWebNet-HA:v2-phase1-architecturefrom
GreenGrassBlueOcean:fix/f500-tuner-dimension-reports
Sep 27, 2026
Merged

GreenGrassBlueOcean merged 1 commit into
OpenWebNet-HA:v2-phase1-architecturefrom
GreenGrassBlueOcean:fix/f500-tuner-dimension-reports

Conversation

@GreenGrassBlueOcean

@GreenGrassBlueOcean GreenGrassBlueOcean commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #498.

Problem Summary

In #427 comment 5849429368, @manfredgittmaier-afk reported that on a live installation (MH200N + F500N tuner, OWNd 2.0.0b8), tuner command transmission worked (station select and next/previous stepped the tuner), but incoming reports (frequency, station, source, and media_title) never updated the entity:

  • When stepping to next track (*16*6001*101##), the bus replied with dimension frames 6, 7, and 8 (*#16*101*6*0*103500##, *#16*101*7*0*4##, *#16*101*8*65*78*84*69*78*78*69*32##), but the entity remained on stale state.
  • Some stations rotate RDS PS text every ~5s (Radio OÖ: *RADIO* / **OOE** ), and transient hardware glitches occasionally emit malformed dimension 8 frames with 12 ASCII codes instead of 8 (e.g. *#16*101*8*42*42*79*79*69*42*79*79*69*42*42*32##).

Root Cause Analysis

  1. OWNSoundEvent dimension values attribute mismatch:
    In OWNd.message.OWNSoundEvent, dimension payload parameters are stored in the instance attribute _dimension_value (e.g. ['0', '103500']), while OWNd does not expose a public dimension_value property.
    In custom_components/myhome/sound_source.py, handle_event evaluated getattr(message, "dimension_value", None) or [], which always returned [] on real OWNSoundEvent instances. Because values was empty, all dimension branches (6, 7, and 8) were skipped. In unit tests, mocks had manually set dimension_value=..., masking the mismatch.
  2. Malformed 12-code RDS frames:
    Transient hardware buffer glitches occasionally emitted dimension 8 frames containing 12 ASCII codes instead of the standard 8 codes.
  3. State hygiene on frequency transition:
    Tuning away to a new frequency should clear any stale media_title from the previous station until new RDS arrives.

Changes

  1. custom_components/myhome/sound_source.py:
    • Extract dimension value list falling back across dimension_value, _dimension_value, and dimension_values.
    • Safely convert dimension to integer.
    • For Dimension 8 (RDS), strictly enforce len(values) == 8; log and ignore malformed frames with length != 8 to prevent title corruption or blanking.
    • Clear _attr_media_title = None when frequency changes in _set_frequency_from_bus and async_set_frequency.
  2. Tests & Authentic Fixtures:
    • Committed the full authentic MH200N + F500N live capture myhome_trace_MH200N_all_2026-09-26T20-00-28.json contributed by @manfredgittmaier-afk under tests/fixtures/traces/f500_tuner/.
    • Updated existing replay tests in tests/test_sound_source_trace_replay.py to instantiate real OWNSoundEvent objects directly from raw bus frames.
    • Added test_f500n_station_advance_and_rds_rotation_replay replaying the full trace and verifying rotating RDS, 12-code glitch rejection, and station advance across presets 1–4.
    • Added unit tests in tests/test_component_sound_source.py for real OWNSoundEvent handling, malformed RDS rejection, and source following after next/previous.

Verification

  • 2,395 passing tests (100% pass rate).
  • 100.0% coverage maintained across all 43 modules (8,295 / 8,295 statements covered, 0 missing lines).
  • ruff check and scripts/verify_ha_standards.py clean with 0 violations.

…formed RDS frames

Resolves issue reported in PR OpenWebNet-HA#427 comment 5849429368:
- Read dimension values from _dimension_value on OWNSoundEvent instances when dimension_value property is not present
- Ensure tuner frequency, station, source and media_title update from incoming bus reports
- Gracefully ignore malformed RDS frames with length != 8 (e.g. transient 12-code glitch frames)
- Clear media_title on frequency change
- Add authentic trace capture and replay test covering rotating RDS, 12-code glitch, and preset advance sequence
@GreenGrassBlueOcean
GreenGrassBlueOcean force-pushed the fix/f500-tuner-dimension-reports branch from 5ce0fcd to 8003e71 Compare September 27, 2026 08:06
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@GreenGrassBlueOcean
GreenGrassBlueOcean merged commit 56bbe8f into OpenWebNet-HA:v2-phase1-architecture Sep 27, 2026
16 checks passed
@GreenGrassBlueOcean
GreenGrassBlueOcean deleted the fix/f500-tuner-dimension-reports branch September 27, 2026 08:12
@manfredgittmaier-afk

Copy link
Copy Markdown

Confirmed working on the MH200N + F500N – frequency, station, source and media_title now follow next/previous and preset changes, and the rotating RDS text (Radio OÖ) updates cleanly. Thanks!

@manfredgittmaier-afk

Copy link
Copy Markdown

@GreenGrassBlueOcean – one more from the MH200N + F441M: volume down on the audio zones still doesn't work.

Bus monitor, amplifier 41:

Button TX Reply
Volume down (pressed twice) *16*1000*41## none – ignored by the amplifier
Volume up *16*1001*41## *#16*41*1*7## + *#22*3#4#1*1*7##

I know this is fixed in OWNd#49 (volume down → *16*1101*<zone>##), but MyHOME still pins OWNd 2.0.0b8, so it doesn't reach users yet. Is an OWNd release planned soon – or could the zone's async_volume_down build *16*1101*<zone>## directly in the meantime, like the tuner entity does for its commands?

@GreenGrassBlueOcean

Copy link
Copy Markdown
Contributor Author

Yes planning on a new release. @fedem95 did a lot of great reviewing already. Waiting on his review and than we make a new ownd release

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.

3 participants