Miele - fix core temperature reading#167476
Conversation
|
Hey there @astrandb, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR fixes invalid temperature value handling in the Miele integration by adding guards to prevent displaying invalid API sentinel values as actual temperature readings. The integration now correctly handles both "-32768" (used by most devices) and "-3276800" (used by some devices) as "no reading" sentinels, ensuring temperature sensors show "unknown" state when the probe is inactive rather than displaying bogus numeric temperatures.
Changes:
- Enhanced
_convert_temperature()function with proper None checks and exception handling for Type/Value errors - Extended DISABLED_TEMP_ENTITIES tuple to include scaled sentinel values (-32768.0 and -32766.0) for devices that report int16 minimum values already in degrees
- Added STEAM_OVEN_MK2 appliance type support to the core temperature sensor definition
- Improved comments to clarify the logic for optional temperature datapoints
- Added two comprehensive test cases covering both sentinel value scenarios
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| homeassistant/components/miele/sensor.py | Enhanced temperature conversion with error handling and added STEAM_OVEN_MK2 support for core temperature sensors |
| homeassistant/components/miele/const.py | Extended DISABLED_TEMP_ENTITIES with scaled sentinel values and added clarifying comments |
| tests/components/miele/test_sensor.py | Fixed comment typo and added two new test functions to verify unknown state handling for both sentinel values |
Proposed change
Add guards and fix mappings of invalid temperatures, as some appliances use "-3276800" as invalid value (in addition to "-32768"), in order to correctly show the "unknown" state on temperature sensors.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: