diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 30d03c1..64b0184 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -5,6 +5,9 @@ # Homebridge MQTT-Thing: Release Notes +### Version 1.1.39 ++ Fix RGB light validation errors (issue #510) + ### Version 1.1.38 + Fix to use valid initial value for airPressure (0 invalid) diff --git a/index.js b/index.js index 621e007..c5919f5 100644 --- a/index.js +++ b/index.js @@ -975,9 +975,9 @@ function makeThing( log, accessoryConfig, api ) { blue = Math.min( blue + white, 255 ); var hsv = RGBtoScaledHSV( red, green, blue ); - var hue = hsv.h; - var sat = hsv.s; - var bri = hsv.v; + var hue = Math.floor( hsv.h ); + var sat = Math.floor( hsv.s ); + var bri = Math.floor( hsv.v ); if( !config.topics.setOn ) { var on = bri > 0 ? 1 : 0; diff --git a/package.json b/package.json index ca06f5a..1844fc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-mqttthing", - "version": "1.1.38", + "version": "1.1.39", "description": "Homebridge plugin supporting various services over MQTT", "main": "index.js", "scripts": { diff --git a/test/backups/instance-backups/homebridge-backup-DB7DA324AA69.1642526521547.tar.gz b/test/backups/instance-backups/homebridge-backup-DB7DA324AA69.1642526521547.tar.gz new file mode 100644 index 0000000..f719686 Binary files /dev/null and b/test/backups/instance-backups/homebridge-backup-DB7DA324AA69.1642526521547.tar.gz differ diff --git a/test/config.json b/test/config.json index 14c7f3a..ea08bed 100644 --- a/test/config.json +++ b/test/config.json @@ -997,6 +997,33 @@ "xsetRotationSpeed": "test/fan/setRotationSpeed" }, "integerValue": true + }, { + "accessory": "mqttthing", + "type": "lightbulb-OnOff", + "name": "Toggle-Light", + "url": "homebridge2", + "logMqtt": true, + "topics": { + "getOn": "test/toggleLight/getOn", + "setOn": { + "topic": "test/toggleLight/setOn", + "apply": "return 1;" + } + }, + "integerValue": true + }, { + "accessory": "mqttthing", + "type": "lightbulb", + "url": "homebridge2", + "topics": { + "getOn": "test/DimmerRgb1", + "setOn": "test/DimmerRgb1", + "getRGB": "test/DimmerRgb1/rgb", + "setRGB": "test/DimmerRgb1/rgb" + }, + "onValue": "on", + "offValue": "off", + "name": "RGBTest" } ] }