I'm personally a great fan of esphome.io. Use simple yaml files to configure a firmware built exactly to your whishes for various esp32 and esp8266 variants. Includes support for a ton of peripherals.
The list of supported hardware is actually a great place to look for which sensors are commonly used for for e.g. air quality, c02, temperature, humidity, power monitoring etc. Almost all supported sensors are available for a few bucks on aliexpress or equivalents.
You can connect the result to home assistant, but you can also move all or some of the logic to the board. So your light still switches on when motion is detected when your WiFi or the server is down. But if motion is detected at certain hours, you'll get a notification via home assistant