最新消息:重新回归WordPress,我要比较认真的开始更新我的博客了。

新版HomeAssistant的mqtt配置示例

服务器相关 hanlei 155浏览

今天更新了homeassistant的版本,发现新版本DC1的mqtt配置用不了了。但是也没有能很直接的找到新版本该怎么配,经过很多的搜索查找,终于还是在官网找到了相关的配置示例。

# Example configuration.yaml entry
mqtt:
  - switch:
      unique_id: bedroom_switch
      name: "Bedroom Switch"
      state_topic: "home/bedroom/switch1"
      command_topic: "home/bedroom/switch1/set"
      availability:
        - topic: "home/bedroom/switch1/available"
      payload_on: "ON"
      payload_off: "OFF"
      state_on: "ON"
      state_off: "OFF"
      optimistic: false
      qos: 0
      retain: true

# Example configuration.yaml entry
mqtt:
  sensor:
    - name: "RSSI"
      state_topic: "home/sensor1/infojson"
      unit_of_measurement: "dBm"
      value_template: "{{ value_json.RSSI }}"
      availability:
        - topic: "home/sensor1/status"
      payload_available: "online"
      payload_not_available: "offline"
      json_attributes_topic: "home/sensor1/attributes"


# Example configuration.yaml entry
mqtt:
  sensor:
    - name: "Temperature"
      state_topic: "office/sensor1"
      suggested_display_precision: 1
      unit_of_measurement: "°C"
      value_template: "{{ value_json.temperature }}
    - name: "Humidity"
      state_topic: "office/sensor1"
      unit_of_measurement: "%"
      value_template: "{{ value_json.humidity }}"

直接用原有配置的参数重新套用一下格式就可以了。

转载请注明:HANLEI'BLOG » 新版HomeAssistant的mqtt配置示例