Skip to content

[web_server] Fix water_heater JSON key names and move traits to DETAIL_ALL#14064

Merged
bdraco merged 1 commit intodevfrom
water-heater-web-server-traits
Feb 19, 2026
Merged

[web_server] Fix water_heater JSON key names and move traits to DETAIL_ALL#14064
bdraco merged 1 commit intodevfrom
water-heater-web-server-traits

Conversation

@bdraco
Copy link
Member

@bdraco bdraco commented Feb 18, 2026

What does this implement/fix?

Fixes two issues with the water_heater web server JSON, discovered while reviewing #14061:

  1. Wrong JSON key names: The backend sent min_temperature/max_temperature but the frontend expects min_temp/max_temp, so slider range limits never worked for water_heater entities.

  2. Static traits sent on every state update: min_temp, max_temp, and step are static traits that never change at runtime. They were being included in every DETAIL_STATE SSE event instead of only in the initial DETAIL_ALL event. The frontend uses Object.assign() to merge SSE updates, so traits from the initial connection persist automatically. Other entity types (number, select, light) already correctly gate their traits behind DETAIL_ALL.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Developer breaking change (an API change that could break external components)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

Pull request in esphome-docs with documentation (if applicable):

  • N/A

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • LN882x
  • nRF52840

Example entry for config.yaml:

# No config changes needed - this fixes the web server JSON output
water_heater:
  - platform: ...
web_server:

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

Existing web_server component tests pass on all 4 platforms (esp32-ard, esp32-idf, esp8266-ard, rp2040-ard).

Move min/max temperature and step traits into DETAIL_ALL block
so they are only sent once on initial connection instead of on
every state update. Rename keys from min_temperature/max_temperature
to min_temp/max_temp to match what the frontend expects.

Discovered while reviewing #14061.
@bdraco bdraco added this to the 2026.2.1 milestone Feb 18, 2026
@github-actions
Copy link
Contributor

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#14064
    components: [web_server]
    refresh: 1h

(Added by the PR bot)

@github-actions
Copy link
Contributor

Memory Impact Analysis

Components: web_server
Platform: esp8266-ard

Metric Target Branch This PR Change
RAM 32,812 bytes 32,812 bytes ➡️ +0 bytes (0.00%)
Flash 413,049 bytes 413,049 bytes ➡️ +0 bytes (0.00%)

Note: This analysis measures static RAM and Flash usage only (compile-time allocation).
Dynamic memory (heap) cannot be measured automatically.
⚠️ You must test this PR on a real device to measure free heap and ensure no runtime memory issues.

This analysis runs automatically when components change. Memory usage is measured from a representative test configuration.

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.11%. Comparing base (81ed703) to head (3a53c5a).
⚠️ Report is 24 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #14064   +/-   ##
=======================================
  Coverage   74.11%   74.11%           
=======================================
  Files          55       55           
  Lines       11588    11589    +1     
  Branches     1577     1578    +1     
=======================================
+ Hits         8588     8589    +1     
  Misses       2598     2598           
  Partials      402      402           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@bdraco bdraco marked this pull request as ready for review February 18, 2026 23:45
Copilot AI review requested due to automatic review settings February 18, 2026 23:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two bugs in the water_heater web server JSON implementation. First, it corrects the JSON key names from min_temperature/max_temperature to min_temp/max_temp to match what the frontend expects (consistent with the climate entity pattern). Second, it moves these static traits into the DETAIL_ALL block so they're only sent during initial connection rather than with every state update, which reduces unnecessary data transfer since the frontend merges updates using Object.assign() and traits persist automatically.

Changes:

  • Fixed JSON key names for water_heater min/max temperature to match frontend expectations
  • Moved static traits (min_temp, max_temp, step) to DETAIL_ALL block to avoid sending them on every state update

@bdraco
Copy link
Member Author

bdraco commented Feb 19, 2026

thanks

@bdraco bdraco merged commit 7e11817 into dev Feb 19, 2026
46 checks passed
@bdraco bdraco deleted the water-heater-web-server-traits branch February 19, 2026 03:00
@swoboda1337 swoboda1337 mentioned this pull request Feb 20, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants