Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoring invalid value #510

Closed
satiromarra opened this issue Dec 12, 2021 · 8 comments
Closed

Ignoring invalid value #510

satiromarra opened this issue Dec 12, 2021 · 8 comments

Comments

@satiromarra
Copy link

When a device is defined as RGB or HSV, the Brightness value received is float.
[RGB] Ignoring invalid value [29.01960784313726] for Brightness - not an integer

The configuration does not allow modifying the Brigthness value:
If topics.setRGB is populated .... brightness, hue and saturation topics are ignored.
If topics.setHSV is populated, a combined value is used and any individual brightness, hue, saturation and color temperature topics are ignored.

Posible solution in "function isValid" add a condition before check "isInteger":

if( typeof value === 'number' ) {
    value = Number.parseInt(value);
}

after:

if( typeof value === 'number' ) {
    value = Number.parseInt(value);
}
if( ! Number.isInteger( value ) ) {
    log( `Ignoring invalid value [${value}] for ${charac.displayName} - not an integer` );
    return false;
}
@lukebrannon1
Copy link

I am having this same issue and unable to get the proper brightness value. Any fixes for this?

@arachnetech
Copy link
Owner

For now you can write an apply function which converts the incoming floating point number to an integer to get around this.

I am tempted to relax the validation by converting numbers to integers automatically, but I haven't had a chance to make this change yet.

@arachnetech
Copy link
Owner

arachnetech commented Jan 30, 2022

Actually, rereading the issue I may have misunderstood the issue. I need to reproduce...

Do you have a sample Config and a sample MQTT message which causes this issue?

@satiromarra
Copy link
Author

satiromarra commented Jan 30, 2022

config:

"accessories": [ 
...
{
    "accessory": "mqttthing",
    "type": "lightbulb",
    "url": "mqtt://xxxxxx:1883",
    "mqttPubOptions": {
        "retain": true
    },
    "topics": {
        "getOn": "DimmerRgb1",
        "setOn": "DimmerRgb1",
        "getRGB": "DimmerRgb1/rgb",
        "setRGB": "DimmerRgb1/rgb"
    },
    "integerValue": false,
    "onValue": "on",
    "offValue": "off",
    "retain": true,
    "name": "RGB"
},
...

log:
[RGB] Ignoring invalid value [29.01960784313726] for Brightness - not an integer

Steps to reproduce error:
In iOS or macOS, open Home app, next activate RGB item and select any color, then view the log file.

@lukebrannon1
Copy link

@satiromarra's description above matches mine, but if you need my config as well I can provide it. It seems the brightness value is being derived from the RGB values instead of from an MQTT message, so I'm not seeing a way to fix this in my config.

@arachnetech
Copy link
Owner

Thanks, both. Very helpful. Sorry, I had initially misunderstood.

@arachnetech
Copy link
Owner

Should be fixed in version 1.1.39.

@satiromarra
Copy link
Author

Updated and works perfectly. Good job! Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants