[SOLVED] Integration give error: "Can't connect to ESP. Please make sure your YAML file contains an 'api:' line."

You said you are rebuilding, how old was your old build?
Esphome now requires an api encryption key.