Sonoff in Bedside Lamp

Has anyone incorporated a sonoff basic outlet with a bedside lamp. Ideally it would be nice to be able to turn the light on and off with the sonoff via MQTT but in the middle of the night its not convenient to ask Alexa or Google to turn the light on or risk blinding yourself with using your phone. A simple pull chain would be nice to be able to use but still retain control from HA vis MQTT. Is there any reason this could not be made? Are there existing projects that have completed this?

Use any kind of mechanical switch, connect the contact to ground and GPIO pin in the Sonoff and configure SwitchMode appropriately.

EDIT: I assumed you are using Tasmota, as you mentioned MQTT

i did this with a sonoff running tasmota. i connected the pull chain of an ikea lamp to one of the GPIO ports (and GND), which then toggles the light if pulled. i retain full control and status control via mqtt. the only issue i ran into was interference picked up by the long cables from GPIO to the pull switch, that i had to filter out using a small capacitor.

That makes sense. I guess what I am concerned with is having a capacitor and having all that right beside the bed. I wish I could find a project with the steps already laid out.