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

unit_of_measurement for linkquality missing in HA #2806

Closed
HA-TB303 opened this issue Jan 23, 2020 · 17 comments
Closed

unit_of_measurement for linkquality missing in HA #2806

HA-TB303 opened this issue Jan 23, 2020 · 17 comments

Comments

@HA-TB303
Copy link

Improvement:

On all my sensors (hue, Ikea and Xiaomi) the unit_of_measurement value for linkquality (dB or % whatever is appropriate) is missing.

Debug Info

zigbee2mqtt version: 1.9.0

image

It would be nice of you could add this.

@HA-TB303 HA-TB303 changed the title unit_of_measurement missing in HA unit_of_measurement for linkquality missing in HA Jan 23, 2020
@nanobra1n
Copy link

Link Quality Indicator (LQI) is the quality of the real data received in a signal.It ranges from 0 to 255, with 255 being the best quality. Therefore, there is no unit_of_measurement, as shown by the "-"

@HA-TB303
Copy link
Author

HA-TB303 commented Jan 24, 2020

Would it not still be perfectly possible to translate those values to a more consumer friendly 0-100 and make the unit of measurement ”%”?

@nanobra1n
Copy link

Including this functionality into zigbee2mqtt is a philosophical question and beyond my pay grade. But if you really want this now, it's as easy as creating your own template sensor

sensor
  - platform: template
    sensors:
      linkqual:
        entity_id: sensor.yoursensor_linkquality
        unit_of_measurement: '%'
        friendly_name: 'My sensor link'
        value_template: '{{states.sensor.yoursensor_linkquality.state| float / 255 * 100}}'
        icon_template: mdi:wifi

Voila

@HA-TB303
Copy link
Author

I know i could do that for my 18 sensors, but that's not what I’m asking 😏

@groenmarsmannetje
Copy link

Maybe just use “lqi” as unit. Besides that I would recommend to use device_class “signal_strength” as default class for all these Linkquality sensors. Currently I have to manually customize that each time.

@Koenkk
Copy link
Owner

Koenkk commented Jan 25, 2020

@groenmarsmannetje done, unit will be lqi now and icon will be set to a signal icon now. Device class signal_strength cannot be used as according to the docs the unit has to be dB for this (https://www.home-assistant.io/integrations/sensor/#device-class)

@pedrolamas
Copy link
Contributor

@Koenkk the dev build got broken after these changes, I assume the tests have failed?

@pedrolamas
Copy link
Contributor

On a side note, I've asked on Home Assistant discord if there would be an interest in having a "lqi" device class of sorts!

@Koenkk
Copy link
Owner

Koenkk commented Jan 26, 2020

@pedrolamas thanks, fixed the tests.

@pedrolamas
Copy link
Contributor

This feels a bit unnecessary and kind of "hacky" to me...

All these sensors end on "_linkquality", so it was quite easy to configure them globally anyway with the customize_glob.yaml file:

"*_linkquality":
  unit_of_measurement: 'lqi'
  icon: mdi:signal

You can check here an example in my own configuration.

@Koenkk
Copy link
Owner

Koenkk commented Jan 27, 2020

@pedrolamas why do you think it's hacky?

@pedrolamas
Copy link
Contributor

Probably a bit of a strong word there (sorry!), but I think this should just be provided on a new device class on Home Assistant rather than having the HA extension supply this metadata.

@Koenkk
Copy link
Owner

Koenkk commented Jan 27, 2020

@pedrolamas yes I agree it should be in a device class, let's see if they'll add it.

@groenmarsmannetje
Copy link

groenmarsmannetje commented Jan 27, 2020

This feels a bit unnecessary and kind of "hacky" to me...

All these sensors end on "_linkquality", so it was quite easy to configure them globally anyway with the customize_glob.yaml file:

"*_linkquality":
  unit_of_measurement: 'lqi'
  icon: mdi:signal

You can check here an example in my own configuration.

Thank you for that tip. I did not know that something like that existed. But of course this probably only works for people using yaml files. Because the architectural view from HA is that integrations and customizations should also be configurable in the front end. Can I do this without editing yaml files?

@carldebilly
Copy link
Contributor

carldebilly commented Jan 27, 2020

Maybe it should be configureable in Z2M.

Also we show follow this issue on HA: home-assistant/architecture#342

@stale
Copy link

stale bot commented Mar 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale issues label Mar 27, 2020
@Koenkk
Copy link
Owner

Koenkk commented Mar 27, 2020

I assume this can be closed, unit is not set to lqi.

@stale stale bot removed the stale Stale issues label Mar 27, 2020
@Koenkk Koenkk closed this as completed Mar 27, 2020
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

6 participants