Link Esphome LED to Home Assistant binary sensor state?

I was wondering if it’s possible, using the Esphome API to link one of the Esphome node’s GPIO to the state of a sensor within Home Assistant? I know I could do the same thing by sending messages using MQTT when the state changes, but is it possible to do it in a ‘tighter’ way with the API?

So, my understanding is you want to turn an LED connected to an ESP on or off depending on the state of a binary sensor in Home Assistant?
Have a look at the Home Assistant Binary Sensor which lets you specify the binary sensor you are interested in, and then you can use automations based on on_press and on_release to turn the LED on and off.