arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
462 stars 104 forks source link

JSON for tasmota ble - connected xiaomi LYWSD0290dd04 #546

Open sommertrip opened 2 years ago

sommertrip commented 2 years ago

Hi!

This is a request for help on the configuration, I don't think it's a bug.

I am very happily using homebridge with many devices over MQTT but I do have issues to get temperatur/humidity displayed fetched from a Xiaomi BLE Device.

I do have the following Setup:

I´d like to get the temperture and humidity displayed in homekit apps. the current JSON in homebridge in the temp section is.

CleanShot 2022-03-14 at 10 55 58@2x

I´ve tried several other configs but can´t get it to work

CleanShot 2022-03-14 at 11 00 07@2x

Maybe a Bug?

rbswift commented 2 years ago

This works well for me in a similar setup

   {
            "accessory": "mqttthing",
            "type": "temperatureSensor",
            "name": "Bathroom Temperature",
            "topics": {
                "getCurrentTemperature": {
                    "topic": "tele/mirrorheater/SENSOR",
                    "apply": "return (Math.round(JSON.parse(message).BME280.Temperature*2)/2);"
                }
            }
        },
sommertrip commented 2 years ago

Hi thx, but didn´t help still receive the following message [6.4.2022, 15:46:00] [homebridge-mqttthing] This plugin generated a warning from the characteristic 'Current Temperature': characteristic value expected valid finite number and received "NaN" (number). See https://git.io/JtMGR for more info.

rbswift commented 2 years ago

NaN means "not a number". Maybe you need to change the topic and BME280

MDo3 commented 2 years ago

I was able to configure this sensor like this. Homebridge console throws warnings, but it works. { "accessory":"mqttthing", "type":"temperatureSensor", "name":"Temperature BLE Living room", "url":"mqtt://localhost", "topics":{ "getCurrentTemperature":"tele/tasmota_D6376C/SENSOR$.LYWSD03c61721.Temperature", "getStatusLowBattery":"tele/tasmota_D6376C/SENSOR$.LYWSD03c61721.Battery" } },

Hi thx, but didn´t help still receive the following message [6.4.2022, 15:46:00] [homebridge-mqttthing] This plugin generated a warning from the characteristic 'Current Temperature': characteristic value expected valid finite number and received "NaN" (number). See https://git.io/JtMGR for more info.

sommertrip commented 2 years ago

Hi thx, did this according to your proposal, but do receive the following in the log files [9.5.2022, 07:20:29] [Xiaomi BLE] Initializing mqttthing accessory... [9.5.2022, 07:20:29] [Xiaomi BLE] Exception while creating services: TypeError: Cannot read properties of undefined (reading 'resubscribe') [9.5.2022, 07:20:29] [Xiaomi BLE] TypeError: Cannot read properties of undefined (reading 'resubscribe') at MqttClient.subscribe (/usr/lib/node_modules/homebridge-mqttthing/node_modules/mqtt/lib/client.js:701:27) at Object.subscribe (/usr/lib/node_modules/homebridge-mqttthing/libs/mqttlib.js:325:24) at mqttSubscribe (/usr/lib/node_modules/homebridge-mqttthing/index.js:50:17) at floatCharacteristic (/usr/lib/node_modules/homebridge-mqttthing/index.js:1221:21) at characteristic_CurrentTemperature (/usr/lib/node_modules/homebridge-mqttthing/index.js:1593:17) at configToServices (/usr/lib/node_modules/homebridge-mqttthing/index.js:2846:17) at createServices (/usr/lib/node_modules/homebridge-mqttthing/index.js:3425:24) at new makeThing (/usr/lib/node_modules/homebridge-mqttthing/index.js:3457:23) at /usr/lib/node_modules/homebridge/src/server.ts:352:50 at Array.forEach () [9.5.2022, 07:20:29] [Xiaomi BLE] Accessory mqttthing returned empty set of services; not adding it to the bridge.