Skip to content

YAML Things ​

This page describes the things element for YAML Configuration.

Things ​

The things top-level key contains a map of Things, defined by their Thing UID.

YAML Definition Syntax ​

yaml
things:
  <thing_uid>:
    isBridge: true|false
    bridge: <bridge_uid>
    label: <Thing label>
    location: <Location>
    config:
      <config key>: <config value>
    channels: # To set channel config or define custom channels
      <channel_id>:
        type: <channel type>
        kind: state|trigger # Default: state
        itemType: <item type>
        itemDimension: <item dimension> # Only if itemType is "Number"
        label: <channel label>
        description: <description>
        config:
          <channel config key>: <config value>
KeyDescription
<thing_uid>The UID of the Thing or Bridge being defined. The UID format is <binding_id>:<thing_type_id>:[<bridge_id>:]<thing_id>, e.g. astro:sun:home.
isBridgeWhether the entity is a Bridge (true) or a Thing (false). Default: false (a Thing).
bridgeThe bridge UID that this Thing belongs to.
labelThing label.
locationThe location of the Thing.
configA key-value map of the Thing's configuration. Refer to the Binding's documentation for details. Textual configuration parameters can reference environment variables using the ${ENV:VARIABLE_NAME} syntax.
channelsConfigure built-in channel parameters, or define custom channels.

Channels Section ​

KeyDescription
<channel_id>The channel ID. It is a single word that when combined with the Thing UID forms the full channel UID.
typeChannel type as defined by the Binding. When the channel type is defined, kind, itemType, and itemDimension should not be defined because the channel type will override them.
kindWhether it's a state channel or a trigger channel. Default: state
itemTypeThe item type that this channel can be linked to. It is required when the channel type is not defined.
itemDimensionThis may be used to further define a Number itemType.
labelChannel label.
descriptionChannel description.
configA key-value or a key-array-of-values map of the channel's configuration. Refer to the Binding's documentation for details.

Example ​

yaml
version: 1

things:
  mqtt:broker:mosquitto:
    isBridge: true
    config:
      host: ${ENV:MQTT_HOST}
      port:
      lwtMessage: offline
      lwtTopic: openhab/status
      lwtQos: 1
      birthMessage: online
      birthTopic: openhab/status
      shutdownMessage: offline
      shutdownTopic: openhab/status
      enableDiscovery: false

  mqtt:topic:bedroom1-switch:
    bridge: mqtt:broker:mosquitto
    label: Bed Room1 Switch
    config:
      availabilityTopic: bedroom1-switch/status
      payloadAvailable: online
      payloadNotAvailable: offline
    channels:
      switch1:
        type: switch
        config:
          stateTopic: bedroom1-switch/switch/switch1/state
          commandTopic: bedroom1-switch/switch/switch1/command
      button1:
        type: string
        config:
          stateTopic: bedroom1-switch/button1
          postCommand: true
      statusled:
        type: switch
        config:
          stateTopic: bedroom1-switch/light/status_led/state
          commandTopic: bedroom1-switch/light/status_led/command
          transformationPattern:
            - JSONPATH:$.state
          formatBeforePublish: '{"state": "%s"}' # This needs to be quoted to be parsed as a string
                                                 # because YAML interprets {} as a map object

  # Example to configure a built-in channel
  astro:sun:home:
    config:
      geolocation: 52.5200066,13.4049540,100
      interval: 60
    channels:
      rise#event:
        type: rangeEvent
        config:
          offset: -30