seime / openhab-esphome

ESPHome native API implementation for openHAB binding
MIT License
24 stars 6 forks source link

Storage of % and ppm values #12

Closed amandel closed 8 months ago

amandel commented 8 months ago

I'm not sure if this is an issue in the ESPHome binding or with the badges. I'm using OpenHAB 4.1.0.

I've noticed that percentage values are stored in the database in the value range of 0-1 (1% == 0.01) as well as ppm values (1 ppm = 1×10^-6 = 0.00001). The badges seem to expect values in the range of 0-100 for percentages. This leads to a humidity display of 0 for values between 0-49% and 1 for values of 50% or above.

The first question would be, who is acting incorrectly? I tried to figure this out, but it might also have changed with the type system changes. Can someone help?

grafik

seime commented 8 months ago

Here is one that I am using for humidity:

Number:Dimensionless Ventilation_Hybel_Bad_Humidity "Hybelventilasjon bad fukt" <humidity> {unit="%",channel="esphome:device:loft:bad_humidity"}

Corresponding esphome config for this channel:

  - platform: bme680_bsec
    bme680_bsec_id: bme680_bad
...
    humidity:
      name: "Bad Humidity"
      filters:
        - median
CleanShot 2024-01-28 at 16 46 29@2x

Could it be that the unit definition isn't present on the item metadata?

If unit is present, please provide DEBUG logs from the binding starting from connect and until first values returned (just a few secs)

amandel commented 8 months ago

Thanks! I also use a BME680 and there was in fact no 'Unit' defined, I've added '%' and 'ppm' now the card looks like expected: grafik