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

[homematic] Fix updating enum config values #14213

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

maniac103
Copy link
Contributor

When changing an enum value in the configuration, we used the wrong data type: while the value in the OH config is a string (the 'option value' - see HomematicThingHandler::getValueForConfiguration), internally we use an integer (the 'option index'), so we have to do the option value -> option index conversion when applying the new value. This especially was a problem for HM-MOD-EM-8 devices, which check the CHANNEL_FUNCTION enum value as part of their initialization routine. When disabling/enabling them after changing the CHANNEL_FUNCTION enum value, they went offline, because their initialization failed due to a NumberFormatException (via
HomematicThingHandler::doInitializeInBackground -> HmChannel::checkForChannelFunctionChange ->
HmChannel::getCurrentFunction)

@maniac103 maniac103 requested a review from gerrieg as a code owner January 13, 2023 14:47
When changing an enum value in the configuration, we used the wrong data
type: while the value in the OH config is a string (the 'option value' -
see HomematicThingHandler::getValueForConfiguration), internally we use
an integer (the 'option index'), so we have to do the option value ->
option index conversion when applying the new value.
This especially was a problem for HM-MOD-EM-8 devices, which check the
CHANNEL_FUNCTION enum value as part of their initialization routine.
When disabling/enabling them after changing the CHANNEL_FUNCTION enum
value, they went offline, because their initialization failed due to a
NumberFormatException (via
HomematicThingHandler::doInitializeInBackground ->
HmChannel::checkForChannelFunctionChange ->
HmChannel::getCurrentFunction)

Signed-off-by: Danny Baumann <[email protected]>
@maniac103 maniac103 force-pushed the homematic-fix-enum-config-update branch from af92580 to 479bffc Compare January 13, 2023 14:47
@jlaur jlaur added the bug An unexpected problem or unintended behavior of an add-on label Jan 13, 2023
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@jlaur jlaur merged commit 4dd60bb into openhab:main Jan 13, 2023
@jlaur jlaur added this to the 4.0 milestone Jan 13, 2023
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Feb 28, 2023
When changing an enum value in the configuration, we used the wrong data
type: while the value in the OH config is a string (the 'option value' -
see HomematicThingHandler::getValueForConfiguration), internally we use
an integer (the 'option index'), so we have to do the option value ->
option index conversion when applying the new value.
This especially was a problem for HM-MOD-EM-8 devices, which check the
CHANNEL_FUNCTION enum value as part of their initialization routine.
When disabling/enabling them after changing the CHANNEL_FUNCTION enum
value, they went offline, because their initialization failed due to a
NumberFormatException (via
HomematicThingHandler::doInitializeInBackground ->
HmChannel::checkForChannelFunctionChange ->
HmChannel::getCurrentFunction)

Signed-off-by: Danny Baumann <[email protected]>
renescherer pushed a commit to renescherer/openhab-addons that referenced this pull request Mar 23, 2023
When changing an enum value in the configuration, we used the wrong data
type: while the value in the OH config is a string (the 'option value' -
see HomematicThingHandler::getValueForConfiguration), internally we use
an integer (the 'option index'), so we have to do the option value ->
option index conversion when applying the new value.
This especially was a problem for HM-MOD-EM-8 devices, which check the
CHANNEL_FUNCTION enum value as part of their initialization routine.
When disabling/enabling them after changing the CHANNEL_FUNCTION enum
value, they went offline, because their initialization failed due to a
NumberFormatException (via
HomematicThingHandler::doInitializeInBackground ->
HmChannel::checkForChannelFunctionChange ->
HmChannel::getCurrentFunction)

Signed-off-by: Danny Baumann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants