[Total newbie] Unable to link number-type item to a channel linked with MQTT broker binding

  • Hardware: RPi2/1GB/32GB
  • OS: openhabian
  • Java Runtime Environment: don’t know
  • openHAB version: 4.3.3
  • Issue of the topic: I’ve created a MQTT broker thing, which receives temperatures as plain strings. I linked a channel of the only type that the UI allows (Publish Trigger). I am able to link a string-type item with this channel but not a number-type item. I want to link the channel to a number type item - if possible. The MQTT message is just a floating point number representing a temperature - so the string should parse trivially to a number. When i try to link a number-type item with the channel, it says there are no default profiles and the list of profiles shown is greyed out.
  • configurations:
UID: mqtt:broker:7a40acd6aa
label: Top floor weather
thingTypeUID: mqtt:broker
configuration:
  lwtQos: 0
  publickeypin: true
  clientid: a153cdff-e842-4a1f-8570-7ffa8b0d1734
  keepAlive: 60
  hostnameValidated: true
  birthRetain: true
  secure: false
  certificatepin: true
  shutdownRetain: true
  protocol: TCP
  qos: 0
  reconnectTime: 60000
  mqttVersion: V3
  host: 192.168.1.11
  lwtRetain: true
  enableDiscovery: true
channels:
  - id: raspi_temp
    channelTypeUID: mqtt:publishTrigger
    label: Raspberry PI (DHT22) temp
    description: ""
    configuration:
      stateTopic: raspberry_pi/temperature
  - id: raspi_humidity
    channelTypeUID: mqtt:publishTrigger
    label: Raspberry PI (DHT22) humidity
    description: ""
    configuration:
      stateTopic: raspberry_pi/humidity

Correct. The Broker Thing only supports publish channels. These are intended to be used for ephemeral events (e.g. button presses).

Then you need to create a Generic MQTT Thing and add number Channels for each topic/message type. Then link those Channels to Items.

The concept of a Thing in OH is that the Thing represents a device. The Broker Thing represents your MQTT Broker but the devices that pub/sub message through that Broker should be represented with separate Things.

See Concepts | openHAB for more on the concept of Things.

1 Like

Thanks. Your guidance helped solve my issue. I was confused between a mqtt broker as a thing and the actual device as a thing.