Comments (12)
Is it specific to MQTT things ?
Is it specific to sitemap UIs, I mean do you get the unit for this item in Main UI ?
PS: As I am not using MQTT, I will not be of a big help.
from openhab-core.
All my things are MQTT-based.
from openhab-core.
Maybe a change in MQTT stuff.
Was it OK in 4.2 milestones ?
@mherwege : maybe a link with your change openhab/openhab-addons#16866 ?
from openhab-core.
And please comment if this is specific to sitemap UIs or the same even in Main UI.
from openhab-core.
Without defining a unit on the MQTT channel, the MQTT binding is providing a default state description pattern of %.1f as the channel has no info about the dimension. If you add a unit definition to the channel it will be solved.
It indeed is caused by openhab/openhab-addons#16866, but I still think it is an improvement, as a default state description pattern of %s (as itwas before) creates many more issues downstream.
from openhab-core.
Considering @mherwege answer, I propose to close the issue.
In case it is not closed, @openhab/core-maintainers please rename this issue into "After upgrade to 4.2 units are not rendered implicitly for MQTT things" and move it in the addons repo.
from openhab-core.
I have an EnOcean device. This Item:
Number:Energy e1_energy "Енергия" ["Energy", "Measurement"] {channel="enocean:measurementSwitch:ABC:01234:totalusage"}
and this Thing from jsondb, excerpt from a bigger definition
{
"uid": "enocean:measurementSwitch:ABC:01234:totalusage",
"id": "totalusage",
"channelTypeUID": "enocean:totalusage",
"itemType": "Number:Energy",
"kind": "STATE",
"label": "",
"defaultTags": [],
"properties": {},
"configuration": {},
"autoUpdatePolicy": "DEFAULT"
},
in a Sitemap file as
Text item=e1_energy
shows in implicit format [%.1f kWh]
For the MQTT-Thing, but not the MQTT-broker binding itself, if unit="V" is part of the mqtt-thing definition, and the item has no state presentation, in the Sitemap on Android it is shown as "Integet V", so there is no "[%.1f V]" to print one digit after the decimal separator. The value is rounded. The statement, that the default in such cases is %.1f UNIT is not correct, the default state presentation for MQTT things, bound to items, is rounded value Integer, followed by unitname.
When I remove [%.1f V] from an Number:ElectricPotential item, bound to an mqtt-thing with unit=V, and put this item on the Overview page (MAin UI), then again it shown as [rounded Integer V],
If the same Number:ElectricPotential item, without presentation, with an mqtt-thing having unit="V", currently the Main UI does not show the unit (volts). My statement is, that OpenHAB 4.1 under the same conditions has shown the implicit unit in the Sitemap.
from openhab-core.
The statement, that the default in such cases is %.1f UNIT is not correct, the default state presentation for MQTT things, bound to items, is rounded value Integer, followed by unitname.
I stand corrected. The default is indeed %.0f %unit% for channels with a unit defined.
It worked before in 4.1 in the case no unit was defined because the state description was just %s. But that lead to problems when a unit is defined in 4.2 (showing the unit twice).
If no unit is defined, the channel will be assumed to represent a plain Number, hence no unit visible because the channel default state description will be %.0f, which you can then override for the item to include the unit.
So, yes, this is a breaking change. Restoring 4.1 behavior would need reverting the PR referred to, and other core PR’s. I believe the current behavior is much more consistent and logical, so I don’t think we should do that. Just adapt your configuration to your needs.
from openhab-core.
There are two ways to imply volts for an entry in a sitemap, without using state presentations:
- if the mqtt thing has unit="V', or
- the item is of type Number:ElectricPotential
I think any of these options should be sufficient to render V implicitly in the state presentation. That is, only the secont point, excluding the first point, should by default render V.
from openhab-core.
So, for items of type number with dimension, linked to channels, the default state presentation does not include the unit. Buf for items of type number with dimensions, not linhed to a channel, the default state presentation does render the unit: #4071 (comment) implied from the dimension, when the channel has no unit itself . I do not think this is very logical.
from openhab-core.
It is very logical. The channel can provide a default state description, and for the MQTT binding it always does. That has higher precedence than the default state description for items, as it is assumed the channel knows better what the default should be. Still higher priority are state descriptions defined on the Item or the Sitemap.
MQTT used to provide %s as default for anything. It now provides a meaningful default for the type of the channel. But if you not provide a unit on a Number type channel, the default will not include a unit.
These precedence rules have been in place since a long time. The MQTT binding caused problems because, while it always provided a default, it provided the wrong one.
from openhab-core.
You should not send values without a number to an item with a dimension. It is only for backward compatibility that the "item unit" is added.
Once you configure the MQTT channels correctly (with a unit) it should work, as @mherwege explained. If it does not work, then the MQTT binding is supplying a wrong state description and needs a fix. This is not a core bug.
from openhab-core.
Related Issues (20)
- SLF4J(W) console output when logging into Karaf console HOT 2
- ThreadPoolManagerTest unstable, affecting all CI builds HOT 2
- ProfileTypeBuilder.withSupportedChannelTypeUIDs is ignored by StateProfileTypeImpl HOT 4
- Add J/kg and grains/m³ units HOT 1
- TimeSeries policy `REPLACE` is ignored when using `PersistenceExtensions.persist`
- Add delay for jar addons at startup
- Minus operator (-) does not work in rules (openHAB 4.2.0) HOT 1
- Unit °dH could not be parsed to a known unit for Item Number:AmountOfSubstance HOT 4
- Allow configuration of popups HOT 6
- Thread exhaustion - possibly out of memory or process/resource limits reached HOT 2
- AbstractStorageBasedTypeProvider doesn't store unitHint HOT 5
- Inline group members instead of a subpage
- Rules / PersistenceExtensions / "no queryable persistence service registered" / should use default rrd4j HOT 8
- [Enhancement/Support] HTTP feature "Transition feature for backward compatibility"
- Remove parameter `sendFrequency` HOT 5
- OpenAPI schema is not in line with REST API
- Median as group function.
- Caclulate the median of persistent data. HOT 2
- Add system channel for `Radiant Exposure` / `energy per unit area`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openhab-core.