Linking one item to MQTT and KNX channels and updating KNX with it

My use case is simple:

  1. retrieve outside temperature
  2. send outside temperature to KNX bus
  3. represent outside temperature in one item

so, I have defined:

  1. an temperature number item, which updates via an MQTT channel
  2. the same item also links to a KNX channel, which should update the bus

Configuration of the item:

the KNX-Channel:

UID: knx:device:pl12:964ac269f0
label: KNX KG Technikraum
thingTypeUID: knx:device
configuration:
  pingInterval: 0
  readInterval: 0
  fetch: false
bridgeUID: knx:ip:pl12
channels:
  - id: KNXTemperatureOutside
    channelTypeUID: knx:number
    label: KNX AuĂźentemperatur
    description: ""
    configuration:
      ga: 0/3/1

the MQTT-channel:

UID: mqtt:topic:synology:MQTTWeatherstation
label: MQTT Wetterstation Binder
thingTypeUID: mqtt:topic
configuration:
  payloadAvailable: openHAB/master/nodered
bridgeUID: mqtt:broker:synology
channels:
  - id: WetterstationTempOutside
    channelTypeUID: mqtt:number
    label: AuĂźentemperatur
    description: ""
    configuration:
      stateTopic: openHAB/master/Wetterstation/tempOutsideC
      max: 60
      min: -30

What happens:
Updating the item via MQTT

  • the item changes
  • no KNX telegram is sent

Updating the item vai REST

  • the item changes
  • KNX telegram is sent

Why is this? Do I miss something, or is it a bug?

That’s how it’s supposed to work.
channels/bindings generally listen for Item commands to send out to devices, and ignore state updates.
channels/bindings generally use incoming data to make Item state updates.

Using REST API, it’s easy to send a command.

There are are of course exceptions to the usual in/out traffic pathways.
The follow profile was created for use cases just like yours.

But as you are using MQTT, the binding provides its own trick for this and you could look at the channel postCommand parameter. Incoming message will be made into command instead of usual state update.

1 Like

Thanks a lot! After activating the “postCommand” (called Is Command in the “show advanced” GUI), it works:
grafik

…and again I have learned something new!