-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[mqtt] Treat incoming empty string as NULL for enum #16641
Conversation
Since openhab#16307, everything except TextValue would treat an empty string as NULL. TextValue was excluded because empty string could be a valid value. Instead it had a config option added to match for a NULL value if you wanted. BUT, if a TextValue has specific valid states configured (such as from Homie or Home Assistant bindings), then empty string is no longer a valid value, and should receive the same treatment of setting the state to NULL when encountered. Signed-off-by: Cody Cutrer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. One question to double check: as the behaviour is slightly different, do you expect issues in existing installations regarding rules ? If so we might consider to add a warning in the distro upgrade. That might also be a bit overdone, wdyt?
ping @ccutrer |
Sorry, I didn't see your comment, just your approval message. I was wondering why it didn't get merged with the approval! Anyhow, no, I don't expect any issues with existing installations. If the valid enum values includes empty string, it will still allow it. So this only changes someone that is not generally expecting an empty string on a topic, it treats it as NULL instead of logging a warning, and doing nothing. This typically means the topics were cleared, either because the device is re-initializing (and likely to re-set to valid value soon), or whatever owns the device is deleting it - both cases that you would expect the state to go to NULL in openHAB. As was mentioned, this is essentially analogous to the prior change for non-text values (which we didn't put a warning in the distro upgrade docs), and I've only heard positive feedback about that change. |
Treat incoming empty string as NULL for enum (openhab#16641) Signed-off-by: Cody Cutrer <[email protected]>
Treat incoming empty string as NULL for enum (openhab#16641) Signed-off-by: Cody Cutrer <[email protected]> Signed-off-by: Paul Smedley <[email protected]>
Treat incoming empty string as NULL for enum (openhab#16641) Signed-off-by: Cody Cutrer <[email protected]> Signed-off-by: Patrik Gfeller <[email protected]>
Treat incoming empty string as NULL for enum (openhab#16641) Signed-off-by: Cody Cutrer <[email protected]>
Treat incoming empty string as NULL for enum (openhab#16641) Signed-off-by: Cody Cutrer <[email protected]>
Treat incoming empty string as NULL for enum (openhab#16641) Signed-off-by: Cody Cutrer <[email protected]> Signed-off-by: Ciprian Pascu <[email protected]>
Since #16307, everything except TextValue would treat an empty string as NULL. TextValue was excluded because empty string could be a valid value. Instead it had a config option added to match for a NULL value if you wanted. BUT, if a TextValue has specific valid states configured (such as from Homie or Home Assistant bindings), then empty string is no longer a valid value, and should receive the same treatment of setting the state to NULL when encountered.