Skip to content

Configuring MQTT on your home automation server

Philibert Cheminot edited this page Jul 7, 2023 · 1 revision

MQTT details

Controlling the stove

  • To light the stove send ON to in_topic, without retain flag.
  • To turn off the stove send OFF to in_topic, with or without retain flag.
  • To force extinction of the stove send force to in_topic, without retain flag.
  • To put the ESP into deep sleep send Sleep to in_topic, with retain flag.
  • To wake up the ESP send Wake to in_topic, with retain flag. (When the ESP is in deep sleep, it wakes up every 5 minutes to check if the Wake message has been received.)

Reset all settings

If you want to reset all the settings here is what you can do:

  • send reset to in_topic or
  • connect the RESET_PIN (D5 (GPIO14) on ESP8266 or GPIO25 on ESP32) to GND (this is not the RST pin of the ESP) or
  • esptool erase_flash but this will also delete the program.

Home Assistant

Here is what to add to configuration.yaml:

mqtt:
    switch:
      - name: ""    #E.g. "Living room"
        state_topic: "mqtt_topic/onoff"    #You have to edit that
        command_topic: "mqtt_topic/intopic"    #Also that
        payload_on: "ON"
        payload_off: "OFF"
        state_on: "ON"
        state_off: "OFF"
        retain: false
        optimistic: false
        qos: 0
  sensor:
    #Salle à manger
      - name: ""    #E.g. "Stove controller power state living room"
        state_topic: "mqtt_topic/pong"
        qos: 0
        icon: mdi:power
      - name: ""    #E.g. "Living room"
        state_topic: "mqtt_topic/ambtemp"
        qos: 0
        unit_of_measurement: "ºC"
        icon: mdi:thermometer
      - name: ""    #E.g. "Fumes temp living room"
        state_topic: "mqtt_topic/fumetemp"
        qos: 0
        unit_of_measurement: "°C"
        icon: mdi:thermometer
      - name: ""    #E.g. "Stove state living room"
        state_topic: "mqtt_topic/state"
        qos: 0
        icon: mdi:fire-alert
      - name: ""    #E.g. "Flame power living room"
        state_topic: "mqtt_topic/flamepower"
        qos: 0
        unit_of_measurement: "%"
        icon: mdi:fire
      - name: ""    #E.g. "Water temp living room"
        state_topic: "mqtt_topic/watertemp"
        qos: 0
        unit_of_measurement: "ºC"
        icon: mdi:coolant-temperature
      - name: ""    #E.g. "Water pressure living room"
        state_topic: "mqtt_topic/waterpres"
        qos: 0
        unit_of_measurement: "bar"
        icon: mdi:gauge