Mqtt Publish not working for all channels

I have newly setup OH3 and first of all must say, I’m quite supprised how well everything seems to work out of the box. But I have a small problem I really don’t understand.

I have setup mosquitto as Mqtt Broker und let OH3 publish some item states to it via a Generic Mqtt Thing.
I’ve setup multiple channels on this thing and added a link to the related item with the follow profile. For two of the items (Aussentemperatur and Stromverbrauch) it works without problems, but I absoluetely don’t have a clue, why it’s not working for the battery status

UID: mqtt:topic:5e6eaf384c:7607ba376c
label: Mqtt Bridge
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:5e6eaf384c
channels:
  - id: Mqtt_Aussentemperatur
    channelTypeUID: mqtt:number
    label: Außentemperatur
    description: ""
    configuration:
      retained: true
      unit: °C
      min: -20
      qos: 2
      formatBeforePublish: "%.2f"
      max: 60
      commandTopic: /outdoor/temperature/state
  - id: Mqtt_Stromverbrauch
    channelTypeUID: mqtt:number
    label: Stromverbrauch
    description: ""
    configuration:
      commandTopic: /kostal/Verbrauch_gesamt
      retained: true
      unit: W
      min: 0
      qos: 2
      max: 7500
  - id: Mqtt_batterie
    channelTypeUID: mqtt:number
    label: Batterie
    description: ""
    configuration:
      qos: 2
      commandTopic: /kostal/battery
      retained: true

The Battery item itself is of type Number:ElectricCharge. There are no log messages indicating any problem, it just does not publish the state in mqtt topic.

Can you show us this bit? Sounds slightly unusual. How are you getting the data for openHAB to publish in the first place?

Sure, I have different bindings connected to OpenHab. Next to Enocean devices I have a Kostal Plenticore Plus 4.2 (with Battery) binding. For those things I’ve added Items in OH3.
The temperature is provided by an Enocean thing, while the power consumption and battery state is provided by the Kostal Plenticore channels.
Each item created for the channels (temperature, battery, power consumption) has two channel links. One directly to the thing’s channel, and one to the Mqtt Generic Thing (the links to the mqtt generic thing are with the “follow” profile within OH3).
The background is, that I want to publish the states of the items to the mqtt broker, to have it accessible via Mqtt for e.g. the MQTT Dash android app.

so the item is defined in org.openhab.core.items.Item.json

"KOSTALPLENTICOREPlus42withBattery_HomeConsumption": {
  "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
  "value": {
    "groupNames": [],
    "itemType": "Number:Power",
    "tags": [
      "Measurement",
      "Energy"
    ],
    "label": "Verbrauch",
    "category": "Energy"
  }
},

and in the ItemChannelLink.json

   "KOSTALPLENTICOREPlus42withBattery_HomeConsumption -\u003e mqtt:topic:5e6eaf384c:7607ba376c:Mqtt_Stromverbrauch": {
     "class": "org.openhab.core.thing.link.ItemChannelLink",
     "value": {
       "channelUID": {
         "segments": [
           "mqtt",
           "topic",
           "5e6eaf384c",
           "7607ba376c",
           "Mqtt_Stromverbrauch"
         ],
         "uid": "mqtt:topic:5e6eaf384c:7607ba376c:Mqtt_Stromverbrauch"
       },
       "configuration": {
         "properties": {
           "profile": "system:follow"
         }
       },
       "itemName": "KOSTALPLENTICOREPlus42withBattery_HomeConsumption"
     }
  },

So this is for the power consumption, which works, but for the battery charge, it’s more or less the same definition, but does not work. The main difference is only that the itemtype is “itemType”: “Number:ElectricCharge” for the battery.

I’m not sure how to interpret the OH3 YAML at the moment - I’ve not migrated over yet. But if I’ve understood correctly, you have:

  • EnOcean Thing which receives the battery data into openHAB, presumably in a Channel.
  • Kostal Thing which transmits the battery data to your MQTT broker via the Mqtt_batterie Channel
  • A single Item which receives the data from the EnOcean Thing, and transmits it to the Kostal Thing via the Follow profile

In an Items file, I have the following:

Number Buero_Temperature "Temperatur [%.2f °C]" <temperature> (Buero) {channel="mqtt:topic:home_bus_knx_5_0:21", channel="mqtt:topic:home_bus_can_node20:a10" [profile="follow"]}

This basically takes in a temperature from the mqtt:topic:home_bus_knx_5_0:21 Channel in a KNX Thing and forwards it on to the mqtt:topic:home_bus_can_node20:a10 Channel in a CAN Thing.

I’m afraid that’s probably not very useful to you.

Did you change the channelTypeUID: at any stage if so delete the whole thing and start again.

Thanks “denominator”, removing the mqtt channel for the battery and adding it again did the trick.
@hafniumzinc, thanks for your suggestions. Btw. the enocean thing provided a temperature, and is working fine, only the kostal thing provided battery state was not working.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.