I connected a raspberry pi zero to my Yamaha keyboard's MIDI out port. I wrote some custom code to watch for different note or chord sequences. When one of those sequences is detected, the RPI notifies Home Assistant which then runs the corresponding automations.
Video: https://youtu.be/ZR4HQgTMhCM?si=rrgkwW-KcySrzOxC
Setup instructions as well as code can be found here: https://nathanorick.com/piano-smart-home-control/