From 6db5909cd777ecea9cf306250bd45ce8450b6250 Mon Sep 17 00:00:00 2001 From: Johan Henkens Date: Tue, 14 Apr 2026 17:48:32 -0700 Subject: [PATCH] Add unit_of_measurement to climate and water_heater --- src/content/docs/components/climate/index.mdx | 14 ++++++++------ src/content/docs/components/water_heater/index.mdx | 14 ++++++++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/content/docs/components/climate/index.mdx b/src/content/docs/components/climate/index.mdx index 1c4cdd6b8c..5945d00f91 100644 --- a/src/content/docs/components/climate/index.mdx +++ b/src/content/docs/components/climate/index.mdx @@ -28,15 +28,16 @@ and can be put in different modes like `HEAT`, `COOL`, `HEAT_COOL` or `OFF`. ## Base Climate Configuration -All climate platforms in ESPHome inherit from the climate configuration schema. In ESPHome, `°C` is assumed for all temperature values. Some platforms allow conversion or setting in `°F`, this is specified separately. +All climate platforms in ESPHome inherit from the climate configuration schema. Use `unit_of_measurement` to configure the temperature unit used by this device. All temperature values in the configuration must either use that unit or omit the unit suffix. If no unit is specified anywhere, Celsius is assumed. ```yaml climate: - platform: ... + unit_of_measurement: °F visual: - min_temperature: 18 - max_temperature: 25 - temperature_step: 0.1 + min_temperature: 60°F + max_temperature: 86°F + temperature_step: 1°F min_humidity: 30% max_humidity: 99% - platform: ... @@ -58,15 +59,16 @@ Configuration variables: > you want the climate to use that name, you can set `name: None`. - **icon** (*Optional*, icon): Manually set the icon to use for the climate device in the frontend. +- **unit_of_measurement** (*Optional*, string): The temperature unit for this device. One of `°C`, `°F`, or `K`. Defaults to `°C` if no unit is specified anywhere. Temperature values in `visual` may include an explicit unit suffix (e.g. `60°F`); if omitted, `unit_of_measurement` is assumed. All explicitly specified units must match. `unit_of_measurement` can also be set implicitly by including a unit suffix on any temperature field — if all suffixed values agree, that unit is used. - **visual** (*Optional*): Visual settings for the climate device - these do not affect operation and are solely for controlling how the climate device shows up in the frontend. - **min_temperature** (*Optional*, float): The minimum temperature the climate device can reach. - Used to set the range of the frontend gauge. + Used to set the range of the frontend gauge. May include an explicit unit suffix (e.g. `18`, `64.4°F`). - **max_temperature** (*Optional*, float): The maximum temperature the climate device can reach. - Used to set the range of the frontend gauge. + Used to set the range of the frontend gauge. May include an explicit unit suffix (e.g. `25`, `77°F`). - **temperature_step** (*Optional*, float): The granularity with which the target temperature can be controlled. Can be a single number, or split as below: diff --git a/src/content/docs/components/water_heater/index.mdx b/src/content/docs/components/water_heater/index.mdx index 42c009e322..a08c0a82c9 100644 --- a/src/content/docs/components/water_heater/index.mdx +++ b/src/content/docs/components/water_heater/index.mdx @@ -17,11 +17,16 @@ The `water_heater` component is a generic representation of water heaters (boile ## Base Water Heater Configuration -All water heater config schemas inherit from this schema - you can set these keys for water heaters. +All water heater platforms in ESPHome inherit from the water heater configuration schema. Use `unit_of_measurement` to configure the temperature unit used by this device. All temperature values in the configuration must either use that unit or omit the unit suffix. If no unit is specified anywhere, Celsius is assumed. ```yaml water_heater: - platform: ... + unit_of_measurement: °F + visual: + min_temperature: 100°F + max_temperature: 145°F + temperature_step: 1°F ``` Configuration variables: @@ -34,13 +39,14 @@ Configuration variables: > to use that name, you can set `name: None`. - **icon** (*Optional*, icon): Manually set the icon to use for the water heater in the frontend. +- **unit_of_measurement** (*Optional*, string): The temperature unit for this device. One of `°C`, `°F`, or `K`. Defaults to `°C` if no unit is specified anywhere. Temperature values in `visual` may include an explicit unit suffix (e.g. `140°F`); if omitted, `unit_of_measurement` is assumed. All explicitly specified units must match. `unit_of_measurement` can also be set implicitly by including a unit suffix on any temperature field — if all suffixed values agree, that unit is used. Advanced options: - **visual** (*Optional*): Configuration for the frontend representation. - - **min_temperature** (*Optional*, float): Override the minimum temperature shown in the frontend. - - **max_temperature** (*Optional*, float): Override the maximum temperature shown in the frontend. - - **target_temperature_step** (*Optional*, float): Override the temperature steps shown in the frontend. + - **min_temperature** (*Optional*, float): Override the minimum temperature shown in the frontend. May include an explicit unit suffix (e.g. `40`, `104°F`). + - **max_temperature** (*Optional*, float): Override the maximum temperature shown in the frontend. May include an explicit unit suffix (e.g. `60`, `140°F`). + - **target_temperature_step** (*Optional*, float): Override the temperature step shown in the frontend. May include an explicit unit suffix (e.g. `1`, `1°F`). - **supported_modes** (*Optional*, list): Static list of operation modes that will be exposed to the frontend (for example Home Assistant). When not specified, all modes supported by the platform are exposed.