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

[basicui] Fix setpoint/slider widgets when %unit% is used in state #1611

Closed
wants to merge 1 commit into from

Conversation

lolodomo
Copy link
Contributor

pattern

In OH3.4, getUnitForWidget(Widget w) now returns null when the state pattern contains "%unit%". In that case, the unit must be searched in the item state.

Fix #1605

Signed-off-by: Laurent Garnier lg.hc@free.fr

@lolodomo lolodomo added bug Something isn't working basic ui Basic UI labels Dec 26, 2022
@lolodomo lolodomo requested a review from a team as a code owner December 26, 2022 20:40
pattern

In OH3.4, getUnitForWidget(Widget w) now returns null when the state
pattern contains "%unit%". In that case, the unit must be searched in
the item state.

Fix openhab#1605

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo lolodomo changed the title [WIP][basicui] Fix setpoint/slider widgets when %unit% is used in state [basicui] Fix setpoint/slider widgets when %unit% is used in state Dec 26, 2022
@lolodomo
Copy link
Contributor Author

This is a fix on branch 3.4.x to be included in the next 3.4 patch.
The build is working on my machine but failed in Github probably because something is not yet correctly setup:

[ERROR] Failed to execute goal on project org.openhab.ui.reactor.bundles: Could not resolve dependencies for project org.openhab.ui.bundles:org.openhab.ui.reactor.bundles:pom:3.4.1-SNAPSHOT: The following artifacts could not be resolved: org.openhab.core.bom:org.openhab.core.bom.compile:pom:3.4.1-SNAPSHOT, org.openhab.core.bom:org.openhab.core.bom.compile-model:pom:3.4.1-SNAPSHOT: org.openhab.core.bom:org.openhab.core.bom.compile:pom:3.4.1-SNAPSHOT was not found in https://openhab.jfrog.io/openhab/libs-snapshot during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of openhab-snapshot has elapsed or updates are forced 

It has been tested successfully on my production environment with the following items:

Number:Temperature DemoTemperature "Temperature [%.2f %unit%]"
Number:Temperature DemoTemperature2 "Temperature 2 [%.2f °C]"
Number:Temperature DemoTemperature3 "Temperature 3"
Number:Temperature DemoTemperature4 "Temperature 4 [%.2f]"
Number DemoTemperature5 "Temperature 5 [%.2f °C]"
Number DemoTemperature6 "Temperature 6"
Number DemoTemperature7 "Temperature 7 [%.2f]"

and the following sitemap:

sitemap demo label="Demo Sitemap" {
        Frame label="Demo Text Items" {
                Text item=DemoTemperature
                Text item=DemoTemperature2
                Text item=DemoTemperature3
                Text item=DemoTemperature4
                Text item=DemoTemperature5
                Text item=DemoTemperature6
                Text item=DemoTemperature7
        }
        Frame label="Demo Slider Items" {
                Slider item=DemoTemperature
                Slider item=DemoTemperature2
                Slider item=DemoTemperature3
                Slider item=DemoTemperature4
                Slider item=DemoTemperature5
                Slider item=DemoTemperature6
                Slider item=DemoTemperature7
        }
        Frame label="Demo Setpoint Items" {
                Setpoint item=DemoTemperature
                Setpoint item=DemoTemperature2
                Setpoint item=DemoTemperature3
                Setpoint item=DemoTemperature4
                Setpoint item=DemoTemperature5
                Setpoint item=DemoTemperature6
                Setpoint item=DemoTemperature7
        }
}

Can someone check what is wrong with the build ? Maybe @wborn or @ghys ?

@lolodomo
Copy link
Contributor Author

Here is a jar for testing the fix (first rename the extension from zip to jar):
org.openhab.ui.basic-3.4.1-SNAPSHOT.zip

Use bundle:update to update your org.openhab.ui.basic bundle with this jar.

@lolodomo lolodomo added rebuild trigger a new Jenkins job and removed rebuild trigger a new Jenkins job labels Dec 26, 2022
lolodomo added a commit to lolodomo/openhab-webui that referenced this pull request Dec 26, 2022
pattern

This is the same fix as openhab#1611 but for OH 4.0 main branch.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@goligo
Copy link

goligo commented Dec 26, 2022

jar testet on my installation - does work for items without state description/pattern as well as items with pattern containing %unit%.

@kaikreuzer kaikreuzer changed the base branch from 3.4.x to main December 27, 2022 08:34
@kaikreuzer kaikreuzer changed the base branch from main to 3.4.x December 27, 2022 08:35
@kaikreuzer
Copy link
Member

@lolodomo Please create the PR against the main branch.

@kaikreuzer kaikreuzer closed this Dec 27, 2022
@lolodomo
Copy link
Contributor Author

@lolodomo Please create the PR against the main branch.

Done, it is #1612

lolodomo added a commit to lolodomo/openhab-webui that referenced this pull request Dec 27, 2022
pattern

This is the same fix as openhab#1611 but for OH 4.0 main branch.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
kaikreuzer pushed a commit that referenced this pull request Dec 31, 2022
)

This is the same fix as #1611 but for OH 4.0 main branch.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
kaikreuzer pushed a commit that referenced this pull request Dec 31, 2022
)

This is the same fix as #1611 but for OH 4.0 main branch.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
crnjan pushed a commit to crnjan/openhab-webui that referenced this pull request Jan 17, 2023
…enhab#1612)

This is the same fix as openhab#1611 but for OH 4.0 main branch.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
@lolodomo lolodomo deleted the getUnitForWidget branch January 5, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
basic ui Basic UI bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants