home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.28k stars 30.6k forks source link

mqtt is not a valid unit for the device class errors for ZW096 power switch #128325

Closed brianmay closed 2 weeks ago

brianmay commented 2 weeks ago

The problem

Getting these errors from device found using zwave ui js.

Oct 14 14:25:59 iot2 homeassistant[192561]: 2024-10-14 14:25:59.902 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.workshop_pump_workshop_pump_electric_power_factor_value (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'Power Factor' which is not a valid unit for the device class ('power') it is using; expected one of ['W', 'kW']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
Oct 14 14:25:59 iot2 homeassistant[192561]: 2024-10-14 14:25:59.903 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.workshop_pump_workshop_pump_electric_pulse_count_value (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'Pulse count' which is not a valid unit for the device class ('power') it is using; expected one of ['W', 'kW']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
Oct 14 14:25:59 iot2 homeassistant[192561]: 2024-10-14 14:25:59.904 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.workshop_pump_workshop_pump_electric_kvah_value (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'kVAh' which is not a valid unit for the device class ('power') it is using; expected one of ['W', 'kW']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

What version of Home Assistant Core has the issue?

core-2024.10.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

mqtt

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

The discovery info for the power factor (can supply others if required):

{
  "type": "sensor",
  "object_id": "electric_power_factor_value",
  "discovery_payload": {
    "value_template": "{{ value_json.value }}",
    "unit_of_measurement": "Power Factor",
    "device_class": "power",
    "state_topic": "zwave/Workshop/Pump/50/0/value/67073",
    "availability": [
      {
        "payload_available": "true",
        "payload_not_available": "false",
        "topic": "zwave/Workshop/Pump/status",
        "value_template": "{{'true' if value_json.value else 'false'}}"
      },
      {
        "topic": "zwave/_CLIENTS/ZWAVE_GATEWAY-linuxpenguins/status",
        "value_template": "{{'online' if value_json.value else 'offline'}}"
      },
      {
        "payload_available": "true",
        "payload_not_available": "false",
        "topic": "zwave/driver/status"
      }
    ],
    "availability_mode": "all",
    "json_attributes_topic": "zwave/Workshop/Pump/50/0/value/67073",
    "device": {
      "identifiers": [
        "zwavejs2mqtt_0xcf5041ec_node16"
      ],
      "manufacturer": "AEON Labs",
      "model": "Smart Switch 6 (ZW096)",
      "name": "Workshop-Pump",
      "sw_version": "1.4"
    },
    "name": "Workshop-Pump_electric_power_factor_value",
    "unique_id": "zwavejs2mqtt_0xcf5041ec_16-50-0-value-67073"
  },
  "discoveryTopic": "sensor/Workshop-Pump/electric_power_factor_value/config",
  "values": [
    "50-0-value-67073"
  ],
  "persistent": false,
  "ignoreDiscovery": false,
  "id": "sensor_electric_power_factor_value"
}

Additional information

Only one of my ZW096 devices is reporting these values, which is also very odd. Have checked configuration, etc, everything looks identical.

home-assistant[bot] commented 2 weeks ago

Hey there @emontnemery, @jbouwh, @bdraco, mind taking a look at this issue as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `mqtt` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign mqtt` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


mqtt documentation mqtt source (message by IssueLinks)

jbouwh commented 2 weeks ago

"unit_of_measurement": "Power Factor"

Using Power Factor as a unit of measurement is not allowed here.

brianmay commented 2 weeks ago

What is the solution? What should "unit_of_measurement" be? Or should that be deleted entirely?

Is kVAh also an invalid unit?

jbouwh commented 2 weeks ago

It seems the logs are clear on this. Also the sensor docs are clear.

jbouwh commented 2 weeks ago

... expected one of ['W', 'kW']; ...

jbouwh commented 2 weeks ago

Power is not the sam as energy

jbouwh commented 2 weeks ago

https://www.home-assistant.io/integrations/sensor/

brianmay commented 2 weeks ago

OK, so it sounds like this is actually a bug in the zwave ui js. Will see if I can file a bug report there.

jbouwh commented 2 weeks ago

Will close this one