Control any HomeAssitant entity_id from esphome

I’ve got an IR receiver/transmitter working and I would like to make it listen to a signal from a remote and perform an action (such as turn on a light)

I set a binary sensor and can use Home Assistant automations to perform the action, but if I want to set a few of them, it seems like a messy approach.

It seems to me there should be a way to “import” a home assistant device_id and perform an action on it (turn off; change color etc) in a similar way that I can import a sensor ID and display it’s value on a display.

tl:dr control one ESPHome device from another ESPHome device.

Any tips?

Mqtt perhaps?

Ooh, possibly.
I’m not using any MQTT at the moment, so it didn’t occur to me, but yeah, that should be possible. I should be able to test by sending an MQTT command to HomeAssistant and checking what happens.
Cheers.