Numeric Item with cut off digits (AND unit)

  • Platform information:
    • openHAB version: 4.2.0

(I think I catched this topic once but can not find it again :frowning: )

I am catching numeric values wit a GenericMQTT Thing:

channels:
  - id: total_consum_kWh
    channelTypeUID: mqtt:number
    label: Total Consumption
    configuration:
      stateTopic: Vorkampsweg/223/zwave/SmartMeterFI1/meter/endpoint_1/value/65537
      unit: kWh
  - id: total_consum_W
    channelTypeUID: mqtt:number
    label: Total Power
    configuration:
      formatBeforePublish: "%f"
      stateTopic: Vorkampsweg/223/zwave/SmartMeterFI1/meter/endpoint_1/value/66049
      unit: W

In both cases I see a value with ONE digit after dot (in MQTT Explorer) like 300.6
But in MainUI I “just” see 300 W
Adding a formatBeforePublish to the Thing does not change anything
Adding a State Description to the Item (Model) with “%.1f” will show me 300.6 but will hide the Unit at the same time.

What do I have to manipulate? Item or the Thing?
How do the two Metadata “unit” and “state description” work together?

What about

%.1f %unit%

Found the solution during creationg a new Item :wink:

So default is the given

%.0f %unit%
1 Like