Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi Signal % is using the wrong device_class #76

Open
ptr727 opened this issue Jan 28, 2025 · 0 comments
Open

WiFi Signal % is using the wrong device_class #76

ptr727 opened this issue Jan 28, 2025 · 0 comments

Comments

@ptr727
Copy link

ptr727 commented Jan 28, 2025

HA reports:

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:709
integration: Sensor (documentation, issues)
First occurred: 6:25:07 PM (1 occurrences)
Last logged: 6:25:07 PM

Entity sensor.konnected_f0f5bd51a9e0_wifi_signal_2 (<class 'homeassistant.components.esphome.sensor.EsphomeSensor'>) is using native unit of measurement '%' which is not a valid unit for the device class ('signal_strength') it is using; expected one of ['dB', 'dBm']; 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+esphome%22

In code:

  - platform: copy
    source_id: wifi_signal_db
    id: wifi_signal_pct
    name: WiFi Signal %
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: diagnostic

WiFi signal is copied from source with a device class that requires dB as unit.
Set an explicit device class to make HA happy.

E.g. in ESPHome docs the device class of the % is set to "":

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"
    device_class: ""
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

No branches or pull requests

1 participant