Skip to content

understanding DEVICES.YML

rhamblen edited this page Nov 24, 2019 · 1 revision

devices.yml

===========

---
# Look for actual scenarios at the end without comments
# Complete example of complex device setup with multiple subscriptions and commands
Living Room Light:
# device name - make sure it is exactly the same as in smartthings
  attribute: switch
  # REQUIRED: mapped to an actual attribute of device [e.g. switch, contact or any custom attribute
  # this attribute is specified in the capability map section of the mbs-smartapp
  # an attribute is required for each topic subbscription
      subscribe:
      # topic details to which smartthings will be subscribed
      # (topic, payload) from MQTT will be transformed to (device, attribute, payload*) to smartthings
        smartthings/stat/sonoff-1/POWER:
        # OPTIONAL: subscribe to this topic, for tasmota you really need it to get status updates for third party on/off
          command:
          # OPTIONAL: Translate payload coming from MQTT to this new payload* send to smartthings
          # For e.g. here OFF command published from MQTT will be sent as off (lowercase) to smartthings
          # if not set payload from MQTT is sent as is
            'OFF': 'off'
            'ON': 'on'
        smartthings/stat/sonoff-1/STATUS:
        # You can subscribe to as many topics 
        smartthings/stat/sonoff-1/STATUS2:
        smartthings/stat/sonoff-1/STATUS5:
        smartthings/stat/sonoff-1/STATUS11:
  publish:
  # OPTIONAL: commands (device, attribute, payload) from smartthings is send to MQTT as (topic, payload*)
    switch:
    #REQUIRED: attribute specified in the capability map section of the mbs-smartapp
      topic: smartthings/cmnd/sonoff-1/POWER
      # REQUIRED: topic to be published to MQTT
      command:
      # REQUIRED: transforming payload from smartthings to the one sent to MQTT and physical device
        'off': 'OFF'
        'on': 'ON'
    update:
      topic: smartthings/cmnd/sonoff-1/Backlog
      command:
      # tasmota specific example of using Backlog to send multiple simultaneous commands to physical device
        refresh: Status; Status 2; Status 5; Status 11
  retain: 'false'
  # false set as default and here