ESPHome

Hi,
I stumbled across ESPHome and it seems to be a nice and easy way to integrate ESPs with different sensor through MQTT. There is support for the usual sensors and everything is configured nicely using yml and even allows OTA-Updates. Has anyone already tried it?

2 Likes

Good Find! I have been using ESPEasy for a while but always good to see free solutions.

I use this framework on ESP32 with multiply (3 currently) MiFlora sensors to report their data via MQTT to OpenHAB. Works beautifully! And all this with just few lines of code:

esphome:
  name: bt
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "***"
  password: "****"

ota:

mqtt:
  broker: "192.168.*.*"

esp32_ble_tracker:

sensor:
  #node uptime [s]
  - platform: uptime
    name: "Uptime"

  #RSSI of MiFlora BT signal
  - platform: ble_rssi
    mac_address: "C4:7C:8D:**:**:**"
    name: "M1 RSSI"

  - platform: xiaomi_miflora
   #MiFlora readings
    mac_address: "C4:7C:8D:**:**:**"
    temperature:
      name: "M1 Temp"
    moisture:
      name: "M1 Moisture"
    illuminance:
      name: "M1 Illuminance"
    conductivity:
      name: "M1 Soil Conductivity"

With above setup I have MQTT topics:

bt/sensor/uptime/state
bt/sensor/m1_rssi/state
bt/sensor/m1_temp/state
bt/sensor/m1_moisture/state
bt/sensor/m1_illuminance/state
bt/sensor/m1_soil_conductivity/state

Documentation is also very clear, with examples, which helps a lot at the beginning.

I highly recommend!

1 Like

I found it a week or two ago.

I have a Sonoff 4ch pro I loaded with it. Works great, responsive. Has built in auto restart on WiFi drop out. The status led is a nice touch.

I have attached mine below, i use it for raising and lowering my projector screen.

esphome:
  name: sonoff_4ch_pro
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: '******'
  password: '******'

# Enable logging
logger:

ota:
  password: '******'
  
mqtt:
  broker: HomeAuto.localdomain
  username: ******
  password: ******
  birth_message:
    topic: sonoff_4ch_pro/status
    payload: online
  will_message:
    topic: sonoff_4ch_pro/status
    payload: offline
    
status_led:
  pin:
    number: GPIO13
    inverted: False

binary_sensor:
- platform: gpio
  pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: True
  name: "Sonoff 4CH Button 1"
  on_press:
    - script.execute: raise_projector_screen
- platform: gpio
  pin:
    number: GPIO9
    mode: INPUT_PULLUP
    inverted: True
  name: "Sonoff 4CH Button 2"
  on_press:
    - script.execute: lower_projector_screen
- platform: gpio
  pin:
    number: GPIO10
    mode: INPUT_PULLUP
    inverted: True
  name: "Sonoff 4CH Button 3"
  on_press:
    - switch.toggle: relay_3
- platform: gpio
  pin:
    number: GPIO14
    mode: INPUT_PULLUP
    inverted: True
  name: "Sonoff 4CH Button 4"
  on_press:
    - switch.toggle: relay_4
- platform: status
  name: "Sonoff 4CH Status"

switch:
- platform: gpio
  name: "Sonoff 4CH Relay 1"
  pin: GPIO12
  id: relay_1
- platform: gpio
  name: "Sonoff 4CH Relay 2"
  pin: GPIO5
  id: relay_2
- platform: gpio
  name: "Sonoff 4CH Relay 3"
  pin: GPIO4
  id: relay_3
- platform: gpio
  name: "Sonoff 4CH Relay 4"
  pin: GPIO15
  id: relay_4

script:
  - id: raise_projector_screen
    then:
      - switch.turn_on: relay_1
      - switch.turn_on: relay_2
      - delay: 15s
      - switch.turn_off: relay_2
      - switch.turn_off: relay_1
  - id: lower_projector_screen
    then:
      - switch.turn_on: relay_2
      - delay: 15s
      - switch.turn_off: relay_2

ESPHome is great tool, what’s nice feature is indeed integration with HA and ability from HA do OTA of your devices…

integration with OH2 would be terrific!

i am Kind of a noob i guess…
i tried and was not able to understand how to flash them? how to create a bin file?
as we dont use HA i just droped it… a litle guide will be great!

I have followed guide: https://esphome.io/guides/getting_started_command_line.html
You will need working python environment in your system, if not installed yet you can follow steps described here https://docs.platformio.org/en/latest/faq.html#faq-install-python

Good luck!

Hi thanks i will give this a try !