Nice!
I'm not sure this supports G502 as it's supposed to be controlled by Logitech G HUB.
Anyway, if you want a CLI replacement for G HUB, I played a bit with opengcontrol [1] to support my new G502 using Claude Code. I wrote a short blog post about it as well [2]. I even got a battery indicator for my menu bar.