Skip to content

Commit b853da8

Browse files
committed
Document Home Assistant discovery overrides
1 parent 4f7a4c9 commit b853da8

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

docs/guide/configuration/devices-groups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ sure to set `mqtt.version` to `5` (see `mqtt` configuration above)
7878
QoS level for MQTT messages of this device. [What is QoS?](https://www.npmjs.com/package/mqtt#about-qos)
7979

8080
**`homeassistant`**
81-
Allows overriding the values of the Home Assistant discovery payload. See example above.
81+
Allows overriding the values of the Home Assistant discovery payload. Overrides can be set globally for the device or for a specific discovered entity under its `object_id`; setting a property to `null` removes it from the discovery payload. See [Home Assistant discovery overrides](../usage/integrations/home_assistant.md#overriding-discovery-properties) for examples.
8282

8383
**`debounce`**
8484
Debounces messages of this device. When setting e.g. `debounce: 1` and a message from a device is

docs/guide/usage/integrations/home_assistant.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ Group discovery properties can be overridden via `groups.<id>.homeassistant` in
117117

118118
Any Home Assistant MQTT discovery property can be overridden on a device. Two examples are shown below. For a full and current list of discovery properties, see [the Home Assistant MQTT Discovery integration](https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery) and [the Home Assistant extension](https://github.com/Koenkk/zigbee2mqtt/blob/03ba647dc6b5f299f8f3ab441712999fcb3a253e/lib/extension/homeassistant.ts) in the Zigbee2MQTT source code.
119119

120+
Overrides can be set at the device level or for a specific discovered entity under its `object_id`.
121+
The entity `object_id` is the part used in the Home Assistant discovery payload, for example `light`, `cover`, `climate`, `temperature`, or a generated composite child such as `manual_default_settings_irrigation_duration`.
122+
Device-specific overrides are applied after Zigbee2MQTT's built-in compatibility mappings, so they can be used to remove or adjust discovery properties that do not match your installation.
123+
Set a discovery property to `null` to remove it from the Home Assistant discovery payload.
124+
120125
### Changing `supported_color_modes`
121126

122127
This is useful for switching light bulbs from reporting values from X/Y (which is the default) to reporting in hue / saturation (which is what bulbs report color in when changing via hue or saturation, such as with the `hue_move` and `saturation_move` commands).
@@ -165,6 +170,50 @@ devices:
165170
state_value_template: '{{ value_json.state_right }}'
166171
```
167172

173+
### Removing unsupported capabilities
174+
175+
Some devices expose generic capabilities that are not useful for every installation. For example, a cover controller can expose tilt controls even when it is connected to a roller blind without slats, or a thermostat discovery payload can expose modes that should not be offered in Home Assistant. These can be adjusted with per-entity discovery overrides.
176+
177+
This example removes the Home Assistant tilt command/status properties from a discovered cover:
178+
179+
```yaml
180+
devices:
181+
'0x12345678':
182+
friendly_name: living_room_blind
183+
homeassistant:
184+
cover:
185+
tilt_command_topic: null
186+
tilt_status_topic: null
187+
tilt_status_template: null
188+
tilt_min: null
189+
tilt_max: null
190+
tilt_closed_value: null
191+
tilt_opened_value: null
192+
```
193+
194+
This example limits a climate entity to the modes that should be offered by Home Assistant:
195+
196+
```yaml
197+
devices:
198+
'0x12345678':
199+
friendly_name: hallway_thermostat
200+
homeassistant:
201+
climate:
202+
modes: ['off', 'heat', 'auto']
203+
```
204+
205+
### Composite controls
206+
207+
When a Zigbee2MQTT expose is a settable composite with numeric or enum child features, Zigbee2MQTT also creates dedicated Home Assistant `number` or `select` entities for those child features. The original composite sensor remains available for viewing the full object.
208+
209+
For example, a composite property named `manual_default_settings` with a numeric child property named `irrigation_duration` is discovered as a Home Assistant number entity using the object ID `manual_default_settings_irrigation_duration`. When changed from Home Assistant it publishes only the changed child field:
210+
211+
```json
212+
{"manual_default_settings": {"irrigation_duration": 30}}
213+
```
214+
215+
If a device requires the full composite object when setting a child field, its converter must merge this partial payload with the current state or expose a non-composite control instead.
216+
168217
### Changing device properties
169218

170219
As an advanced example to show changing any MQTT property can be overridden, the following configuration changes the `suggested_area` property of the `device`. The example shows that you can just copy the given MQTT discovery hierarchy underneath the `homeassistant` property (given that `suggested_area` is underneath the `device` property). Please note, that other `device` properties are possibly set by Zigbee2MQTT (e.g. `manufacturer`).

0 commit comments

Comments
 (0)