Skip to content

OpenSENSE and ESPHome

There are multiple ways you can use your OpenSENSE board.

One of the easiest ways to get your OpenSENSE up and running is by using ESPHome and adding it to your HomeAssistant.

Example ESPHome configuration

A very simple ESPHome configuration is available in the GitHub repository.

How to configure ESPHome?

There are multiple configuration options that you can play around with but here are some of the options that you should always include.

ESPHome section

Make sure you specify your platform and board as esp32

esphome:
  name: opensense-$hostname
  platform: esp32
  board: esp32-c3-devkitm-1
  platformio_options:
    board_build.f_cpu: 80000000L

I2C Bus section

Both sensors are connected to the same I2C bus and you should configure the bus as follows

i2c:
  sda: 7 # Do not change this or sensors will fail to work
  scl: 4 # Do not change this or sensors will fail to work
  scan: false
  id: bus_a # You can reference this bus in your sensor sections

Sensor section

You should specify BME280 and LTR390 in your sensor section.

sensor:
  - platform: bme280
    id: bme280_sensor
    temperature:
      name: "$sensorname Temperature"
      oversampling: 16x
    pressure:
      name: "$sensorname Pressure"
    humidity:
      name: "$sensorname Humidity"
    address: 0x77

  - platform: ltr390
    id: ltr390_sensor
    uv:
      name: "$sensorname UV Index"
    light:
      name: "$sensorname Light"

Device name

If you are using example configuration, instead of manually renaming each sensor line, you can just modify your substitutions: section at the top of the .yaml file.

FAQ - Frequently Asked Questions

Should I put the sensor to sleep?

Yes. Even if your device is not battery powered.

The main reason is that ESP32 will heat up over time as well as both sensors.
While this amount of heat is negligible in most cases, over time it could accumulate enough to skew your readings.

Ideally you want your device to wake up -> take sensor readings -> go to sleep

The recommended way of doing this is through events (as specified in example config)

# Enable Home Assistant API
api:
  encryption:
    key: "$encryptionkey"

  on_client_connected:
    - delay: 100ms
    - component.update: bme280_sensor
    - component.update: ltr390_sensor
    - delay: 1s # Immediately after sending new values, wait 1s and go to sleep
    - deep_sleep.enter:
        sleep_duration: 1min  # Leave the board in sleep mode for longer periods of time to prevent heat build up.
                              # If ESP32 is constantly on, it will generate heat that over time can affect temperature reading

Can I use this sensor for real-time sensor readings?

Yes and no.

This sensor was designed to be used for periodical (ie every 30sec, every 1min etc.) sensor readings.

It is possible to take sensor readings in shorter intervals (ie every 5sec) however this will affect your temperature reading because the ESP32 chip will heat up over time.