Mine is pretty basic but is built on the shoulders of giants. Also that $20 was from pre-pandemic / pre-chip shortage prices. I'm guessing it's more like $35 now, or maybe high $20s from ali express.
I use Home Assistant for home automation. It has a now official addon called ESPHome for easily configuring esp devices and adding them to Home Assistant.
- I bought some cheap dev boards off amazon and thankfully they worked
- an esp8266 microcontroller with IC2 headers and a microusb port already onboard
- a bmp280 that measures temp, humidity, and barometric pressure
- a lux sensor with a plastic dome over the top
- I soldered them together on a prototyping board
All the components were supported by esphome, so I just needed to write the device config and then flash the devboard via esphome (in a web browser) over the built in usb.
I 3d printed a housing for it, but you can also buy boxes. It needs airflow but also needs to stay dry. You can use a spray sealant to help avoid corrosion from ambient humidity. I skipped that step because I want to see how quickly it becomes problematic... and I should probably check on that.