Skip to content

Fix HA entity names for derived weather sensors by removing device_class#31234

Merged
Koenkk merged 1 commit intoKoenkk:devfrom
danielpetrovic:patch-1
Mar 3, 2026
Merged

Fix HA entity names for derived weather sensors by removing device_class#31234
Koenkk merged 1 commit intoKoenkk:devfrom
danielpetrovic:patch-1

Conversation

@danielpetrovic
Copy link
Copy Markdown
Contributor

What

Removes device_class from the following NUMERIC_DISCOVERY_LOOKUP entries:

  • dew_point (was temperature)
  • wind_chill (was temperature)
  • humidex (was temperature)
  • apparent_temperature (was temperature)
  • gust_speed (was wind_speed)

Why

Z2M's HA discovery intentionally deletes the name field from the MQTT discovery payload when device_class is present, letting HA auto-generate the entity name from the device class. This works correctly for unique sensors — a single temperature sensor shows "Temperature", a single humidity sensor shows "Humidity", etc.

However, devices that expose multiple sensors sharing the same device_class are affected. For example, a weather station may expose dew_point, wind_chill, humidex and apparent_temperature alongside a raw temperature sensor — all five previously had device_class: temperature, so HA showed "Temperature" for all of them. Likewise, gust_speed shared device_class: wind_speed with wind_speed, causing both to show "Wind speed".

Removing device_class from these derived sensors preserves the name in the discovery payload so HA displays the correct labels ("Dew point", "Wind chill", etc.). Long-term statistics are unaffected as they are driven by state_class and unit_of_measurement, neither of which changed.

Z2M removes the `name` field from the MQTT discovery payload when `device_class` is present, letting HA auto-generate the entity name from the device class. For unique sensors (temperature, humidity) this works correctly. However, dew_point, wind_chill, humidex and apparent_temperature all shared device_class "temperature", causing HA to show "Temperature" for all four. Similarly, gust_speed shared device_class "wind_speed" with wind_speed, showing "Wind speed" for both.

Removing device_class from these derived sensors preserves the name in the discovery payload so HA shows the correct labels. LTS is unaffected as statistics are driven by state_class and unit_of_measurement, neither of which changed.
@Koenkk Koenkk merged commit b7b4303 into Koenkk:dev Mar 3, 2026
11 checks passed
@Koenkk
Copy link
Copy Markdown
Owner

Koenkk commented Mar 3, 2026

Thanks!

@danielpetrovic danielpetrovic deleted the patch-1 branch March 3, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants