Skip to content

fix: point fixture sense product at an existing hub device - #172

Open
matt-thepie wants to merge 2 commits into
Pyhass:devfrom
matt-thepie:fix/fixture-sense-parent
Open

matt-thepie wants to merge 2 commits into
Pyhass:devfrom
matt-thepie:fix/fixture-sense-parent

Conversation

@matt-thepie

Copy link
Copy Markdown
Contributor

Summary

The sense product in src/data/data.json pointed at parent-0000-0000-0000-000000000001, an ID no device in the fixture has. In file mode (username="use@file.com") HiveHelper.get_device_data does devices[product["parent"]] for sense products, so add_list caught a KeyError and logged it three times, once per sense entity, and the Glass, Smoke and Dog Bark binary sensors were silently dropped from device_list.

  • Fix: point the sense product at the fixture's hub device, hub-0000-0000-0000-000000000001, which is also the real-world shape (sense is a hub product).
  • Regression test: test_file_fixture_has_no_dangling_parents starts a file-mode session, asserts no ERROR log records, and asserts the three sense binary sensors are discovered. It fails on the old fixture and passes on the new one.

No library code changes. Home Assistant is unaffected: the fixture is only used for offline testing.

Verification

  • Full pytest tests/: 1062 passed, coverage 100%.
  • scripts/check_data_pii.py src/data/data.json: passed.
  • ruff, ruff format, pylint 10/10 on the test file.
  • Before: file-mode start_session produced 5 binary sensors and 3 ERROR logs. After: 8 binary sensors, no errors.

🤖 Generated with Claude Code

The sense product in src/data/data.json referenced a parent ID no device had, so file-mode sessions logged a KeyError for each sense entity and silently dropped the Glass, Smoke and Dog Bark binary sensors. Point it at the fixture hub and add a regression test that asserts a file-mode start_session logs no errors and discovers all three sense sensors.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (dev@0294877). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##             dev     #172   +/-   ##
======================================
  Coverage       ?   99.96%           
======================================
  Files          ?       30           
  Lines          ?     2643           
  Branches       ?      310           
======================================
  Hits           ?     2642           
  Misses         ?        0           
  Partials       ?        1           
Flag Coverage Δ
unittests 99.96% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant