Skip to content

Commit 9b57427

Browse files
bvweerdclaude
andcommitted
Add unit of measurement customization section to README
Explains why the PID output has no fixed unit (per HA architecture) and provides two workarounds: customize.yaml and a template sensor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dd8394c commit 9b57427

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Manual Installation](#manual-installation)
1212
- [Removal Instructions](#removal-instructions)
1313
- [Configuration](#configuration)
14+
- [Customizing the Unit of Measurement](#customizing-the-unit-of-measurement)
1415
- [Entities Overview](#entities-overview)
1516
- [PID Tuning Guide](#pid-tuning-guide)
1617
- [Manual Tuning](#1-manual-trial--error)
@@ -91,6 +92,50 @@ The controller’s setpoint range defaults to **0.0 – 100.0**. To customize th
9192

9293
---
9394

95+
## 🏷️ Customizing the Unit of Measurement
96+
97+
The PID output sensor has no fixed unit of measurement, because the output value depends entirely on your application (e.g. %, °C, A, W). Per Home Assistant architecture, units cannot be configured inside the integration itself — instead, use one of the approaches below.
98+
99+
### Option 1: customize.yaml
100+
101+
Add a device class and unit to the entity directly. This works for the PID output sensor and for number entities such as `Setpoint`.
102+
103+
**`configuration.yaml`**
104+
```yaml
105+
homeassistant:
106+
customize: !include customize.yaml
107+
```
108+
109+
**`customize.yaml`**
110+
```yaml
111+
sensor.my_pid_controller_pid_output:
112+
device_class: temperature
113+
unit_of_measurement: "°C"
114+
115+
number.my_pid_controller_setpoint:
116+
device_class: temperature
117+
unit_of_measurement: "°C"
118+
```
119+
120+
> **Note:** Only set `device_class` to a value that matches the physical meaning of the output. Using a wrong device class can affect history graphs and unit conversions.
121+
122+
### Option 2: Template sensor
123+
124+
Use a template sensor to wrap the PID output with any unit and label you need. This is useful when you want a clean, named entity without modifying the raw output entity.
125+
126+
**`configuration.yaml`** (or your `template:` block):
127+
```yaml
128+
template:
129+
- sensor:
130+
- name: "Heater setpoint output"
131+
unit_of_measurement: "°C"
132+
device_class: temperature
133+
state_class: measurement
134+
state: "{{ states('sensor.my_pid_controller_pid_output') | float(0) | round(2) }}"
135+
```
136+
137+
---
138+
94139
## 📊 Entities Overview
95140

96141
| Platform | Entity Suffix | Description |

0 commit comments

Comments
 (0)