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

[mqtt.generic] Create the proper item type for channels with units #17929

Merged
merged 2 commits into from
Dec 29, 2024

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Dec 20, 2024

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-4-3-zigbee2mqtt-color-temperature-in-mired-not-working/160911/13

@ccutrer
Copy link
Contributor Author

ccutrer commented Dec 20, 2024

Build will fail until openhab/openhab-core#4507 is merged.

andrewfg

This comment was marked as outdated.

@jlaur jlaur added the bug An unexpected problem or unintended behavior of an add-on label Dec 20, 2024
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

@lolodomo
Copy link
Contributor

Waiting for the merge of the required change in core framework.

I assume the fix should be backported into 4.3 ?

@andrewfg
Copy link
Contributor

the fix should be backported into 4.3

Yes. I think so. Both this PR in addons and the corresponding UnitUtils PR in core.

Copy link
Contributor

@andrewfg andrewfg left a comment

Choose a reason for hiding this comment

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

As discussed in OH core

if (unit == null) {
return CoreItemFactory.NUMBER;
}
String dimension = UnitUtils.getDimensionName(unit);
Copy link
Contributor

@andrewfg andrewfg Dec 29, 2024

Choose a reason for hiding this comment

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

You need to add your special Mirek case handler here. And only call getDimensionName() for other units.

String dimension = Units.MIRED == unit ? "Temperature" : UnitUtils.getDimensionName(unit);

Signed-off-by: Cody Cutrer <[email protected]>
@ccutrer ccutrer removed the awaiting other PR Depends on another PR label Dec 29, 2024
@ccutrer
Copy link
Contributor Author

ccutrer commented Dec 29, 2024

This is no longer dependent on the core PR

Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM

@lolodomo lolodomo merged commit dcb6d6e into openhab:main Dec 29, 2024
3 checks passed
@lolodomo lolodomo added this to the 5.0 milestone Dec 29, 2024
@jlaur jlaur changed the title [mqtt.generic] create the proper item type for channels with units [mqtt.generic] Create the proper item type for channels with units Dec 29, 2024
lolodomo pushed a commit that referenced this pull request Dec 29, 2024
…17929)

* [mqtt.generic] create the proper item type for channels with units

Signed-off-by: Cody Cutrer <[email protected]>
@lolodomo lolodomo added the patch A PR that has been cherry-picked to a patch release branch label Dec 29, 2024
@lolodomo
Copy link
Contributor

Nack-ported to 4.3.x branch.

@andrewfg
Copy link
Contributor

@ccutrer congrats :) sorry that it was like squeezing water out of a stone :(

@ccutrer ccutrer deleted the mqtt-generic-number-unit-dimension branch December 29, 2024 19:18
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 patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants