File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -908,10 +908,15 @@ export default class HomeAssistant extends Extension {
908
908
delete discoveryEntry . discovery_payload . device_class ;
909
909
}
910
910
911
- // Home Assistant only supports µg/m³, not other units like ppb .
911
+ // Home Assistant uses a different voc device_class for µg/m³ versus ppb or ppm .
912
912
// https://github.com/Koenkk/zigbee2mqtt/issues/16057
913
913
if ( firstExpose . name === 'voc' && discoveryEntry . discovery_payload . unit_of_measurement !== 'µg/m³' ) {
914
- delete discoveryEntry . discovery_payload . device_class ;
914
+ if ( discoveryEntry . discovery_payload . unit_of_measurement === 'ppb' ||
915
+ discoveryEntry . discovery_payload . unit_of_measurement === 'ppm' ) {
916
+ discoverEntry . discovery_payload . device_class = 'volatile_organic_compounds_parts' ;
917
+ } else {
918
+ delete discoveryEntry . discovery_payload . device_class ;
919
+ }
915
920
}
916
921
917
922
// entity_category config is not allowed for sensors
You can’t perform that action at this time.
0 commit comments