Publish MQTT

That’s ok, ESPHome questions are welcome too. You got the right category.

You have specified boat as a topic prefix in your mqtt setup block. You don’t need to include it in the publish topic. Also you need to include an id and your payload should be:

sensor:
  - platform: bme280
    temperature:
      name: "OutsideTemp"
      id: outside_temp
      oversampling: 16x
      on_value:
        - mqtt.publish_json:
            topic: "temperature"
            payload: |-
              root["OutsideTemp"] = id(outside_temp).state;

This should publish something like, {"OutsideTemp": "99"} to the topic boat/temperature

2 Likes