fix: filter garbage data from Daikin API responses#94
fix: filter garbage data from Daikin API responses#94gcamp wants to merge 5 commits intozlangbert:mainfrom
Conversation
The Daikin API occasionally returns sentinel values (255, 65535) when the thermostat restarts or loses connectivity. These garbage values result in unrealistic sensor readings like 127.5% demand or 655.35kW power usage. This change adds validation to detect these sentinel values and skip updates with corrupted data, preserving the last known good state instead. A warning is logged when garbage data is detected for debugging purposes. Fixes zlangbert#79 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@zlangbert any chance for a review and merge? This project seems unmaintained at this point |
- Add pytest and pytest-asyncio to dev dependencies - Create comprehensive test suite for garbage data detection - Tests verify sentinel value detection (255, 65535) - Tests verify state preservation when garbage data received - Update CI workflow to run tests on PRs and main branch - Configure pytest with async support in pyproject.toml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Hi @gcamp, thanks for the PR and ping, I've been meaning to come back to this at some point. When I was initially looking at this (#22), I remember thinking I wanted to filter out specific sensor updates with sentinel values rather than not update anything. The reasoning being I couldn't be sure that we wouldn't get sentinel values for one thing and not another, potentially blocking updates to new values we do want. Now that you have looked into this more, any additional insight on that? How confident are you in this approach? |
- Add proper type hints to all test fixtures and methods - Import LogCaptureFixture from pytest for caplog typing - Use type: ignore comments for private method access - Add file-level pyright configuration for necessary suppressions - All tests pass and pyright reports 0 errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add return type annotation (-> None) - Add type annotation for valid_devices list - Resolves pyright strict mode type checking errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove ctIFCFanRequestedDemandPercent from the list of fields checked for garbage sentinel values. Update corresponding test. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Hard to be confident at 100% when you're working on an private API but I can say that :
I also added tests, but feel free to remove them if you don't think they add value (since there was no test before). Currently testing my branch on my home assistant, I can report back in a week or two to make sure everything is good. |
This is essentially the issue I am most concerned about. I have seen a lot of different combinations of reported / non-reported values for people with differing equipment, some of which I can't make any sense of. The more I think about this the more I feel we should take a more granular approach. My philosophy at this point is the less we assume about the relationships between fields the better |
The Daikin API occasionally returns sentinel values (255, 65535) when the thermostat restarts or loses connectivity. These garbage values result in unrealistic sensor readings like 127.5% demand or 655.35kW power usage.
This change adds validation to detect these sentinel values and skip updates with corrupted data, preserving the last known good state instead. A warning is logged when garbage data is detected for debugging purposes.
Fixes #79