homebridge-switchbot icon indicating copy to clipboard operation
homebridge-switchbot copied to clipboard

Bug: plugin loses humidity values for IO-Sensor during Parsing

Open nfoonf opened this issue 8 months ago • 8 comments

Describe the Bug

in v3.4.0 the IOSensor support loses values for humidity during parsing. In the debug log, one can see that the values are received but change to undefined during parsing

To Reproduce

install v3.4.0 v3.5.0 puts home bridge into a reboot cycle of death, but the bug is in the code as well as far as I can see

Expected Behavior

get humidity data, obviously

Relevant Log Output

[5/30/2024, 3:13:00 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse address: d9:30:38:35:20:41, model: w
[5/30/2024, 3:13:00 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse serviceData: {"model":"w","modelName":"WoIOSensorTH","temperature":{"c":20.8,"f":69.4},"fahrenheit":true,"humidity":57,"battery":100}
{
  model: 'w',
  modelName: 'WoIOSensorTH',
  temperature: { c: 20.8, f: 69.4 },
  fahrenheit: true,
  humidity: 57, <========== DATA IS HERE
  battery: 100
}
{
  model: 'w',
  modelName: 'WoIOSensorTH',
  temperature: { c: 20.8, f: 69.4 },
  fahrenheit: true,
  humidity: 57,
  battery: 100
}
{
  model: 'w',
  modelName: 'WoIOSensorTH',
  temperature: { c: 20.8, f: 69.4 },
  fahrenheit: true,
  humidity: 57,
  battery: 100
}
{
  model: 'w',
  modelName: 'WoIOSensorTH',
  temperature: { c: 20.8, f: 69.4 },
  fahrenheit: true,
  humidity: 57,
  battery: 100
}
{
  model: 'w',
  modelName: 'WoIOSensorTH',
  temperature: { c: 20.8, f: 69.4 },
  fahrenheit: true,
  humidity: 57,
  battery: 100
}
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse BLEparseStatus
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] Terasse BatteryLevel: 100, StatusLowBattery: 0
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse Humidity: undefined% <======= Data is lost
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse Temperature: 20.8°c
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse CurrentRelativeHumidity: undefined
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse updateCharacteristic CurrentTemperature: 20.8
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse updateCharacteristic BatteryLevel: 100
[5/30/2024, 3:13:03 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse updateCharacteristic StatusLowBattery: 0
[5/30/2024, 3:13:13 PM] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Current Relative Humidity': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[5/30/2024, 3:13:13 PM] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Current Temperature': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[5/30/2024, 3:13:13 PM] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Current Relative Humidity': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[5/30/2024, 3:13:13 PM] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Current Relative Humidity': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[5/30/2024, 3:13:13 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse BLERefreshStatus
[5/30/2024, 3:13:13 PM] [SwitchBot] [DEBUG] WoIOSensor: Terasse BLE Address: d9:30:38:35:20:41

Config for homebridge-switchbot

the config can be seen here:

 "name": "SwitchBot",
            "credentials": {
                "token": "dsfsdfgsdfgsdf",
                "secret": "sdfgsdfgsfdg",
                "notice": "Keep your Token & Secret a secret!"
            },
            "options": {
                "devices": [
                {
                        "deviceId": "D93038352041",
                        "configDeviceName": "Terasse",
                        "configDeviceType": "WoIOSensor",
                        "connectionType": "BLE",
                        "scanDuration": 10,
                        "history": false,
                        "refreshRate": 20,
                        "external": true,
                        "logging": "debug"
                    }
                ]

Screenshots

No response

Device and Model

raspberry pi model 4 running docker

Node.js Version

v20.12.2

NPM Version

10.5.0

Homebridge Version

Homebridge v1.8.2 in docker container homebridge/homebridge:2024-05-02

Homebridge Switchbot Plugin Version

3.4.0

Homebridge Config UI X Plugin Version

No response

Operating System

Raspian

nfoonf avatar May 30 '24 13:05 nfoonf