You should take a look at Logitech’s Harmony. It integrates well with openhab and can control most receivers, tv’s and other devices. I use it with openhab to control an older Onkyo receiver, a newer Sony TV, an xbox, a set-top box, an other devices.
Same as @bdollerup, I’m doing this with Logitech Harmony Hubs. When my Chromecasts turn on/off, OH automatically turns on/off my AV equipment and sets the input channels.