You thought about it, do IT !

ESPHome MultiSensor – Illuminance

ESPHome MultiSensor – Illuminance
Project progress
10%

Make your own Home Assistant ultimate MultiSensor. First we will study illuminance sensor using ESPHome..

For this project you will need :

Wiring diagram :

Then connect this to your computer using usb cable, and launch home assistant. You will need to install ESPHome add-on from supervisor menu.

Start the addon and select the option to see ESPHome on the left menu,.

You’re done, now go to ESPHome menu item, then select NEW DEVICE

Select CONTINUE

Name your device (For example MultiSensor1)

Uncheck Use Recommended settings

Choose ESP8266 and Wemos D1 Mini Lite

Backup the Encryption Key somewhere. Now it’s time to code. You should have something like that when you click on MultiSensor1 and then Edit

esphome:
  name: MultiSensor1
  friendly_name: MultiSensor1

esp8266:
  board: d1_mini_lite

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "98sd564df5sf45sfs48sdskdlkdsldklsdklsdksldk78ds"

ota:
  password: "c02ab566144acbd1d7b931e87d57d1a0"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: "1pKuaaFLdmXD"

captive_portal:

Next we have to enable D1 mini I2C in order to be able to communicate with the sensor. For that add this lines at the end of the yaml

i2c:
  sda: D2
  scl: D1
  scan: False

Last step is setting up sensor communication . We set the sensor type, name, sensor I2C address (0x23 by default), and reading interval.

sensor:
  - platform: bh1750
    name: "BH1750 Illuminance"
    address: 0x23
    update_interval: 30s

That’s all the coding we need ! It’s time to flash the Wemos D1 Mini. Click save, then install.

Choose Plugin to this computer.

Now when the firmware is ready, download it and launch ESPHome web firmware flasher. Select the WeMos D1 Com Port and flash it.

Your new device should now be online in Home Assistant !

Now you can check the values of your new entity going to supervisor, integrations, ESPHome, devices

do-it.dev Avatar
if you liked it, please contribute !

Leave a Reply

Your email address will not be published. Required fields are marked *

Aurélien Bordinat

I am a french computer engineer, adept of DIY, home automation and new technologies. When i’m not busy trail running, i spend some time prototyping.