Commit cf27d0e
[BT] Omit state_class/unit_of_measurement for enum sensors in HA discovery (#2316)
Home Assistant rejects an MQTT discovery payload that carries `options`
(an enum sensor) together with `state_class` or `unit_of_measurement`:
these fields are mutually exclusive. createDiscovery() was emitting all
three for Mi Body Composition Scale (XMTZC0x) weighing_mode/unit sensors,
so HA discarded the discovery message.
Gate the stat_cla and unit_of_meas writes on enum_options == nullptr so
enum sensors no longer carry the conflicting fields.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6d64dbc commit cf27d0e
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
508 | 511 | | |
509 | 512 | | |
510 | 513 | | |
| |||
578 | 581 | | |
579 | 582 | | |
580 | 583 | | |
581 | | - | |
582 | | - | |
| 584 | + | |
| 585 | + | |
583 | 586 | | |
584 | 587 | | |
585 | 588 | | |
| |||
0 commit comments