Skip to content

Fix water_heater false error, add mean_type/unit_class for HA 2026.11, fix temperature state_class#540

Open
mosandlt wants to merge 1 commit intobosch-thermostat:masterfrom
mosandlt:master
Open

Fix water_heater false error, add mean_type/unit_class for HA 2026.11, fix temperature state_class#540
mosandlt wants to merge 1 commit intobosch-thermostat:masterfrom
mosandlt:master

Conversation

@mosandlt
Copy link
Copy Markdown

Summary

  • water_heater.py: Fix false ERROR: A target temperature must be provided — the error fired when an automation set the same temperature already active. Now only errors when target_temp is None; silently skips if temperature is unchanged.

  • sensor/statistic_helper.py: Add mean_type (StatisticMeanType.NONE) and unit_class to StatisticMetaData — required by HA 2026.11 (currently warning). Both use try/except fallbacks for older HA versions. unit_class is derived from unit of measurement (kWh/Wh → energy, kW → power).

  • sensor/base.py + sensor/recording.py: Fix WARNING: sensor state_class 'total' is impossible for device_class 'temperature' — the bosch library returns state_class=total for temperature sensors (e.g. sensor.ractualtemp), which is invalid. Override to measurement when device_class is temperature.

Test plan

  • Confirm no ERROR: A target temperature must be provided when automation sets same temperature already active
  • Confirm no WARNING: mean_type not specified on startup
  • Confirm no WARNING: unit_class not specified on startup
  • Confirm no WARNING: state_class 'total' impossible for temperature on startup

Tested on HA 2026.3.4 with bosch-thermostat custom component.

🤖 Generated with Claude Code

… fix temperature state_class

- water_heater.py: Fix false error 'A target temperature must be provided'
  when automation sets the same temperature that is already active.
  Only error when target_temp is None; silently skip if unchanged.

- sensor/statistic_helper.py: Add mean_type (StatisticMeanType.NONE) and
  unit_class to StatisticMetaData to satisfy HA 2026.11 requirements.
  Both use safe fallbacks for older HA versions.

- sensor/base.py + sensor/recording.py: Fix sensor.ractualtemp warning
  'state_class total is impossible for temperature device class'.
  Override state_class to measurement when device_class is temperature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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