Code for a new build

Hi

I am building a new small project using an esp8266, dht22 and two reed switches to be insiide an office cupboard which has two doors

I am wanting to know

  • Temperature
  • Humidity
  • Left door status (open/closed)
  • Right door status (open/closed)

The idea is to

  • trigger my fans if it gets too warm in there (have a NAS etc in there) which are in has already
  • trigger my led strip if any of the doors are open, the strip is in has already

I think the below is all i need, i would imagine the above is done with automations in HAS.

Code

esphome:
  name: esp-office-cupboard

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "encryption-key-here"

ota:
  password: "ota-key-here"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Office-Cupboard"
    password: "my-password-here"

captive_portal:

sensor:
  - platform: dht
    model: DHT22
    pin:
      number: D3
   #   mode: INPUT_PULLUP
    temperature:
      name: "Office Cupboard Temperature"
    humidity:
      name: "Office Cupboard Humidity"
    update_interval: 300s
    
binary_sensor:
  - platform: gpio
    pin:
      number: D0
      inverted: true
      mode: INPUT_PULLDOWN_16
    id: reed_switch
    name: "Reed Switch Right Door"

  - platform: gpio
    pin:
      number: D1
      inverted: true
      mode: INPUT_PULLDOWN_16
    id: reed_switch
    name: "Reed Switch Left Door"

Hoping to get feedback on the code please and any other suggestions.

Thank you

Looks about right. If it works I would say it is fine.

Yes it would be typical to do the automations in HA in this kind of situation.