ESP32 how to turn led ON

Hi to all .

I have searched the forum but no luck with the existing topics.

I have created a remote control with ESP32 and i have make some automations when i press the buttons .

The think that i want to do is to know when is connected to Home Assistant api and the connection is alive and turn on a led at GPIO port

I have read some with interval to do it but no luck there .

The other think is when one automation trigger to turn on another led on GPIO port .

Thanks in advance

Look at the thread posted by @tom_l. In the first post there is code where I do almost what you are looking for.