From b048d7023c0af35ccb92e350133730e36473fb30 Mon Sep 17 00:00:00 2001 From: David Miller Date: Sun, 17 Oct 2021 22:09:11 +0100 Subject: [PATCH] Improve compatibility with older Node.js versions --- docs/ReleaseNotes.md | 3 +++ index.js | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index b6238ea..3ddc3bb 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -5,6 +5,9 @@ # Homebridge MQTT-Thing: Release Notes +### Version 1.1.32 ++ Improve compatibility with older Node.js versions + ### Version 1.1.31 + Improve null handling (multicharacteristic) (thanks, Jakub Samek) + Added optimizePublishing option diff --git a/index.js b/index.js index 32dd249..751fcc9 100644 --- a/index.js +++ b/index.js @@ -1279,7 +1279,7 @@ function makeThing( log, accessoryConfig, api ) { // MQTT set (Homekit get) if( getTopic ) { mqttSubscribe( getTopic, property, function( topic, message ) { - let data = message?.toString() ?? ''; + let data = message ? message.toString() : ''; let newState = mqttToHomekit[ data ]; if( newState !== undefined && ( eventOnly || state[ property ] != newState ) ) { if( config.logMqtt ) { diff --git a/package.json b/package.json index 29d4f72..7bbc754 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-mqttthing", - "version": "1.1.31", + "version": "1.1.32", "description": "Homebridge plugin supporting various services over MQTT", "main": "index.js", "scripts": {