ESPHOME config check

Hello,

I have a ESP32c3 board with 2 miflora sensors…

is this config correct? I am asking because sometime i dont have a connection to the board

esphome:
  name: florasensordevice
  platformio_options:
    board_build.f_flash: 40000000L
    board_build.flash_mode: dio
    board_build.flash_size: 4MB

#esp32:
#  board: az-delivery-devkit-v4
#  framework:
#    type: arduino 

esp32:
  variant: ESP32C3
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf

wifi:
  ssid: "xxxx"
  password: "xxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Florasensordevice"
    password: "xoXHVuz3fLJh"

captive_portal:

web_server:
  port: 80
  
mqtt:
  broker: "xxxxx"
  port: 1883
  username: "xxx"
  password: "xxx"
  discovery: false
  will_message:
    topic: florasensordevice/status
    payload: "offline"
  birth_message:
    topic: florasensordevice/status
    payload: "online"

logger:

api:

ota:

esp32_ble_tracker:
  
sensor:
  - platform: xiaomi_hhccjcy01
    mac_address: "xxxxxxx" # Replace with your sensor's MAC address
    temperature:
      name: "MiFlora1 Temperature"
      id: miflora1_temperature
    moisture:
      name: "MiFlora1 Moisture"
      id: miflora1_moisture
    illuminance:
      name: "MiFlora1 Illuminance"
      id: miflora1_illuminance
    conductivity:
      name: "MiFlora1 Soil Conductivity"
      id: miflora1_conductivity
    battery_level:
      name: "MiFlora1 Battery Level"
      id: miflora1_battery
  - platform: xiaomi_hhccjcy01
    mac_address: "xxxxxx" # Replace with your sensor's MAC address
    temperature:
      name: "MiFlora2 Temperature"
      id: miflora2_temperature
    moisture:
      name: "MiFlora2 Moisture"
      id: miflora2_moisture
    illuminance:
      name: "MiFlora2 Illuminance"
      id: miflora2_illuminance
    conductivity:
      name: "MiFlora2 Soil Conductivity"
      id: miflora2_conductivity
    battery_level:
      name: "MiFlora2 Battery Level"
      id: miflora2_battery
 
interval:
  - interval: 5min
    then:
      - mqtt.publish:
          topic: "florasensordevice/sensor1/temperature"
          payload: !lambda |-
            return to_string(id(miflora1_temperature).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor1/moisture"
          payload: !lambda |-
            return to_string(id(miflora1_moisture).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor1/illuminance"
          payload: !lambda |-
            return to_string(id(miflora1_illuminance).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor1/conductivity"
          payload: !lambda |-
            return to_string(id(miflora1_conductivity).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor1/battery"
          payload: !lambda |-
            return to_string(id(miflora1_battery).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor2/temperature"
          payload: !lambda |-
            return to_string(id(miflora2_temperature).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor2/moisture"
          payload: !lambda |-
            return to_string(id(miflora2_moisture).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor2/illuminance"
          payload: !lambda |-
            return to_string(id(miflora2_illuminance).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor2/conductivity"
          payload: !lambda |-
            return to_string(id(miflora2_conductivity).state);
      - mqtt.publish:
          topic: "florasensordevice/sensor2/battery"
          payload: !lambda |-
            return to_string(id(miflora2_battery).state);

Is there a reason you are using mqtt rather than the API?

If you put in api, but don’t connect using the api, it will reboot periodically (I think every 15 mins). Remove the api tag, or if you really need it, set the reboot_timeout:

Yeah I need mqtt because my other devices are not using the esphome API…but good to know I was not aware of the reboot if not using the api

1 Like

That makes no sense.