Skip to content

[climate][water_heater] Document TemperatureUnit C++ API for custom components#6827

Open
jhenkens wants to merge 5 commits into
esphome:nextfrom
jhenkens:add-temperature-unit-cpp-api-docs
Open

[climate][water_heater] Document TemperatureUnit C++ API for custom components#6827
jhenkens wants to merge 5 commits into
esphome:nextfrom
jhenkens:add-temperature-unit-cpp-api-docs

Conversation

@jhenkens

Copy link
Copy Markdown

Description

Documents the new TemperatureUnit enum and set_temperature_unit() C++ API added to ClimateTraits and WaterHeaterTraits. This allows custom C++ component authors to declare that their device reports temperatures in Fahrenheit or Kelvin, and have that unit conveyed to Home Assistant via the ESPHome API.

Adds a "Custom C++ Components: Setting Temperature Unit" subsection to both the Climate and Water Heater component docs, showing:

  • How to call traits.set_temperature_unit(esphome::TemperatureUnit::FAHRENHEIT) in a custom component
  • The available TemperatureUnit enum values (CELSIUS, FAHRENHEIT, KELVIN)

Related issue (if applicable): N/A

Pull request in esphome with YAML changes (if applicable):

Checklist

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • Link added in /src/content/docs/components/index.mdx when creating new documents for new components or cookbook.

…omponents

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit f88f7e5
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/6a395bd279bce90008c4a508
😎 Deploy Preview https://deploy-preview-6827--esphome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Documents the new TemperatureUnit enum and set_temperature_unit() C++ API for custom component authors so they can report Fahrenheit/Kelvin to Home Assistant via traits.

Changes:

  • Added a “Custom C++ Components: Setting Temperature Unit” subsection to the Climate docs with a code example and available enum values.
  • Added the same subsection to the Water Heater docs with a code example and available enum values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/content/docs/components/climate/index.mdx Adds documentation and an example for setting temperature units on ClimateTraits (example currently needs adjustment to use traits() correctly).
src/content/docs/components/water_heater/index.mdx Adds documentation and an example for setting temperature units on WaterHeaterTraits (example should use fully-qualified trait type).

Comment thread src/content/docs/components/climate/index.mdx Outdated
Comment thread src/content/docs/components/water_heater/index.mdx Outdated
jhenkens and others added 2 commits June 22, 2026 08:17
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jhenkens jhenkens marked this pull request as ready for review June 22, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants