openhab-core: Switch item with linked channel and hysteresis profile leads to error on the item
I’m using openHAB 3.0 with docker on a linux host system.
My use case is an alarm indicating that the humidity in my bathroom is over a certain upper value. When this happens the bathroom fan is turned on to bring the humidity down. The fan should stay on until the humidity drops below a certain lower value.
For this I configured a switch item carrying the alarm value and linked it to the humidity sensor with a channel configured for the hysteresis profile.
The expected outcome should be a switch item handling the alarm value with the hysteresis in place. The current outcome is that the item goes into an error state.
The item configuration is:
The channel link configuration is:
As you can see in the screen shots, the state is “Err”. The probable cause might be the following log entry:
2020-12-30 00:41:22.012 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value 'OFF' of item Badezimmer_Sicherheit_Feuchtigkeitsalarm with format '%.0f': f != java.lang.String
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 31 (6 by maintainers)
Commits related to this issue
- Display raw item state when formatting fails (#2349) * Display raw item state when formatting fails With the addition of Profiles, there are situations where a Channel sends format information tha... — committed to openhab/openhab-core by brianwarner 3 years ago
- Display raw item state when formatting fails (#2349) * Display raw item state when formatting fails With the addition of Profiles, there are situations where a Channel sends format information tha... — committed to fwolter/openhab-core by brianwarner 3 years ago
- Subject: [PATCH] Display raw item state when formatting fails (#2349) * Display raw item state when formatting fails With the addition of Profiles, there are situations where a Channel sends format ... — committed to opensmarthouse/opensmarthouse-core by brianwarner 3 years ago
- Subject: [PATCH] Display raw item state when formatting fails (#2349) * Display raw item state when formatting fails With the addition of Profiles, there are situations where a Channel sends format ... — committed to opensmarthouse/opensmarthouse-core by brianwarner 3 years ago
- Oh updates to 3.1.0M1 (#29) * Subject: [PATCH] Fixed NPE in ScriptError if INode is empty (#1985) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> --- X-Backport-Id: 7ce96ac06adcb... — committed to opensmarthouse/opensmarthouse-core by cdjackson 3 years ago
- Display raw item state when formatting fails (#2349) * Display raw item state when formatting fails With the addition of Profiles, there are situations where a Channel sends format information that ... — committed to ConnectorIO/copybara-hab-core by brianwarner 3 years ago
It’s going to require some kind of framework policy decision. Should linking an Item to a channel always allow the binding to ‘force-feed’ presentation metadata pattern and options? If not, why not? When there are multiple links, perhaps? And/or when target Item type does not match channel type?
Or add an option to the linking process, supply by default but allow denial by user selection?
This is all in “advanced use” area, but recent proliferation of system profiles and binding-specific profiles make it likely to come up more often.
I agree with https://github.com/openhab/openhab-core/issues/2037#issuecomment-753381920 and an easy way to fix this is to change the following line 157
https://github.com/openhab/openhab-core/blob/a82d3effb7bf268249ec066bb5c67613dc08a312/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/SseItemStatesEventBuilder.java#L153-L158
to
and suppress the warning.