I'll definitely start with Home Assistant (or OpenHab, if you want to keep Java) and EspHome/Tasmota, in your case.Don't start from scratch.

Tasmota and EspHome are two firmware quite popular in the market, and you'd flash them on microcontrollers and access sensors. Look at both before choosing. I prefer Tasmota, but only because that's what I know better.

After you'll be set, you'd always add anything you want to the mix. I'm a C# dev and part of my logic runs inside a custom made applications, that's glueing different systems together. Take a look at Multi System Reactor as well, since you'll soon discover that Home Assistant lacks in terms of a powerful automation engine. Good luck!