-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Make input formatting for transformations consistent everywhere #4203
base: main
Are you sure you want to change the base?
Conversation
93a78f3
to
238d91e
Compare
53a4385
to
a2b7e74
Compare
...rg.openhab.core.transform/src/main/java/org/openhab/core/transform/TransformationHelper.java
Outdated
Show resolved
Hide resolved
50eec80
to
93376fb
Compare
93376fb
to
7ab9ad3
Compare
This is now ready for review, I have updated the initial message and I provided screenshots of Main UI and sitemap UI (Baisc UI) showing the different cases when transformation is used. |
ec232f8
to
3dcd04c
Compare
The consequence for users of these changes is that now they will have to consider input value "NULL" and "UNDEF" in their transformations. It will impact mainly sitemap UIs users as they could have considered "-" as input value rather than "NULL" and "UNDEF". Users using only Main UI should probably be not impacted, they will just be happy with the fix for use case Test02. |
3dcd04c
to
c369f0c
Compare
Use item state formatter to format input of transformation, meaning using state.format(format) instead of String.format(format, state.toString()) This was already the case in sitemap API but not in other APIs used by Main UI. Make sure to call transformation even for NULL and UNDEF states. It was not the case in one API used by Main UI. When calling transformation and state is NULL or UNDEF, do not apply format to the input value and do not replace by "-". That means the transformation will be called with "NULL" or "UNDEF". Sitemap API was calling the transformation using a pattern containing "-". Fix openhab#4101 Also related to discussion in openhab/openhab-addons#13777 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
c369f0c
to
653fad3
Compare
Use item state formatter to format input of transformation, meaning using state.format(format) instead of String.format(format, state.toString())
This was already the case in sitemap API but not in other APIs used by Main UI.
Make sure to call transformation even for NULL and UNDEF states.
It was not the case in one API used by Main UI.
When calling transformation and state is NULL or UNDEF, do not apply format to the input value and do not replace by "-".
That means the transformation will be called with "NULL" or "UNDEF".
Sitemap API was calling the transformation using a pattern containing "-".
Fix #4101
Also related to discussion in openhab/openhab-addons#13777
Signed-off-by: Laurent Garnier lg.hc@free.fr