MQTT Binding: Publish item values - Strange behaviour

Hello all,

i am currently trying to publish item number values via MQTT Binding to other MQTT-connected devices.
However, i observered a strange behaviour.

Both things and items are configured exactly the same way. However, in one case the value is correctly published via MQTT, in the other case not. The topic just stays empty.

The Things MQTT_link_Humidor_Temperatur and MQTT_link_Balkon_Temperatur to publish the linked items (follow mode) are configured the same.



Also the linked items Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_1_Temperatur and Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur are configured the same.

Also the Things to receive the Temperature value of the Xiaomi Sensors (Bluetooth to MQTT) are configured the same. Both do have the unit “°C”.




The result is the following:
image

Balkon_Temperature is publishing a value. Humidor_Temperatur not.
I completly dont understand why…

Of course i also can directly receive the Bluetooth to MQTT topic in my MQTT-connected device. However, i want to expand this approach for many other items which are not all MQTT connected already.

Maybe someone can help me.

BTW: Is there a way to configure such stuff via code in VisualStudio? The GUI is nice but for a lot of Things and items very time consuming…

Where available, please post the contents of the Code tab instead of screen shots. Screen shots cannot be read on phones (too small font), cannot be searched, we can’t copy/paste/edit to the solution. The only time you won’t have a Code tab is for Items.

Use code fences when you do.

```
code goes here
```

Errors in the logs? Is the Item changing?

You can switch to using text based configs. But those can’t be edited in the UI at all, only viewed. But you don’t have to click through the UI to create lots of similar Things. See the “Buying in Bulk” sections of OH 3 Tips and Tricks.

Hello, i completely understand!
However, i set it up only in the GUI.
Therefore, i can not post any code.

Yes both items to change their values.
But what can be observered in the log is that
Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur does not contain a “°C”.
Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_1_Temperatur contains a “°C”

This is strange because both are configured the same …

2021-07-20 16:40:17.954 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur changed from 35.8 to 35.1

2021-07-20 16:41:30.987 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur changed from 35.1 to 34.8

2021-07-20 16:45:55.278 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur changed from 34.8 to 34.9

2021-07-20 16:47:30.891 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur changed from 34.9 to 35.0

2021-07-20 16:48:36.229 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_4_Temperatur changed from 35.0 to 35.1

Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_1_Temperatur
2021-07-20 16:37:56.099 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_1_Temperatur changed from 25.8 °C to 25.7 °C

2021-07-20 16:38:16.191 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_1_Temperatur changed from 25.7 °C to 25.8 °C

2021-07-20 16:51:33.199 [vent.ItemStateChangedEvent] - Ble2mqtt_Ble2mqtt_Xiaomi_Sensor_1_Temperatur changed from 25.8 °C to 25.9 °C

Ok, i found the reason!
The items were not configured completely the same.
I set the dimension to temperature in one case.
I deleted this dimension and now it works fine :slight_smile:

Except for Items, every single setting page has a Code tab.

Things

Rules

and so on for Pages, Widgets, the Overview page and everything else.

Clicking on that will show the configuration as text you can paste into a forum posting. Screen shots are worthless to us. That’s why the Code tab exists. This is what an MQTT Bridge Thing with a Channel looks like in that code tab.

UID: mqtt:broker:broker
label: Mosquitto MQTT Broker2
thingTypeUID: mqtt:broker
configuration:
  lwtQos: 2
  publickeypin: true
  clientID: openhab
  keepAlive: 60
  lwtMessage: OFFLINE
  lwtTopic: openhab/status
  secure: false
  certificatepin: true
  password: PASSWORD
  qos: 2
  reconnectTime: 60000
  port: 1883
  host: argus.koshak.net
  lwtRetain: true
  username: USER
  enableDiscovery: false
channels:
  - id: dadsoh_out
    channelTypeUID: mqtt:publishTrigger
    label: Dad's OH EB out topics
    description: ""
    configuration:
      stateTopic: dadsoh/out/#
      separator: "#"

The OP is using OH2.

Ah, I missed that. Screen shots are really hard to look at on the phone.

In that case, the most useful thing would be to use the REST API Docs to query for the Thing and post the resultant JSON.