I need to do something similar. I have a Esp32S3 music player/ voice assistant connected to my old Yamaha, 90s AV receiver. It can change the volume knob via IR commands (cool integrated motor that physically turns the knob when the remote or HA changes the volume with IR).
I want to do something like put a ring magnet and an encoder on the tiny shaft or something to get position feedback to couple to HomeAssistant/musicassistant.