snowdd1 / homebridge-knx

KNX platform shim for homebridge
https://github.com/nfarina/homebridge
GNU General Public License v2.0
97 stars 56 forks source link

Humidity (9.007) shows wrong in Home.app #190

Closed carp3-noctem closed 3 years ago

carp3-noctem commented 3 years ago

I've added two humidity sensors with the following lines:

{
            "DeviceName": "Luftfeuchte Badezimmer",
            "Services": [
                {
                    "ServiceType": "HumiditySensor",
                    "ServiceName": "Luftfeuchte",
                    "Characteristics": [
                        {
                            "Type": "CurrentRelativeHumidity",
                            "Listen": [
                                "7/4/121"
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "DeviceName": "Luftfeuchte WC",
            "Services": [
                {
                    "ServiceType": "HumiditySensor",
                    "ServiceName": "Luftfeuchte",
                    "Characteristics": [
                        {
                            "Type": "CurrentRelativeHumidity",
                            "Listen": [
                                "7/4/141"
                            ]
                        }
                    ]
                }
            ]
        },

Both are delivering wrong Values, did i need to choose a Handler for them to be correctly displayed? When read the Values with the ETS i got

1A 6C 49.6%

in Homekit it shows up as 19%

Thanks in Advance. If any additional feedback is helpful let me know and i will provide as soon as possible.

And also thanks for your effort for that great and stable working Plugin. You did an awesome job!

snowdd1 commented 3 years ago

That actually is weird, because https://github.com/homebridge/HAP-NodeJS/blob/master/src/lib/gen/HomeKit.ts#L759 says it is a percentage type. So the calculation performed will be perc = (bus value -> decimal) / 255 * 100 (pseudo code only)

For a display of 19%, there should have been a 30 hex (48 decimal) on the bus.

carp3-noctem commented 3 years ago

I will recheck what is on the Bus at Thursday and will come back with the Information.

Anything else i should provide?

snowdd1 commented 3 years ago

Ahh!
I didn't see you already mentioned DPT 9.007 in the issue header. It is required to hint homebridge-knx to that.

https://github.com/snowdd1/homebridge-knx/blob/master/knx_config.json.md#characteristics

                {
                    "ServiceType": "HumiditySensor",
                    "ServiceName": "Luftfeuchte",
                    "Characteristics": [
                        {
                            "Type": "CurrentRelativeHumidity",
                            "Listen": [
                                "7/4/141"
                            ],
                            "DPT":"DPT9"
                        }
                    ]
                }

should do the trick...

carp3-noctem commented 3 years ago

@snowdd1 Thanks for the hint, that was missed by myself. It is now working as it should! I will close this issue!