Skip to content

Commit

Permalink
Fix RGB light validation failures
Browse files Browse the repository at this point in the history
[RGB] Ignoring invalid value [29.01960784313726] for Brightness - not an integer
  • Loading branch information
arachnetech committed Feb 1, 2022
1 parent f2e86f4 commit 1c45bfc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
3 changes: 3 additions & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Binary file not shown.
27 changes: 27 additions & 0 deletions test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}

0 comments on commit 1c45bfc

Please sign in to comment.