|
11 | 11 | - [Manual Installation](#manual-installation) |
12 | 12 | - [Removal Instructions](#removal-instructions) |
13 | 13 | - [Configuration](#configuration) |
| 14 | +- [Customizing the Unit of Measurement](#customizing-the-unit-of-measurement) |
14 | 15 | - [Entities Overview](#entities-overview) |
15 | 16 | - [PID Tuning Guide](#pid-tuning-guide) |
16 | 17 | - [Manual Tuning](#1-manual-trial--error) |
@@ -91,6 +92,50 @@ The controller’s setpoint range defaults to **0.0 – 100.0**. To customize th |
91 | 92 |
|
92 | 93 | --- |
93 | 94 |
|
| 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 | + |
94 | 139 | ## 📊 Entities Overview |
95 | 140 |
|
96 | 141 | | Platform | Entity Suffix | Description | |
|
0 commit comments