I have a couple of smart lights/smart outlets that do this.
I mostly needed it because for whatever weird ass reason my living room doesn't have lights despite being built in 1994. The lamp I use is fine, but the wall switch for the outlet it's plugged into is by the front entry door, I come in the side entrance where the garage is. So I've rigged it up so that I can turn the lamp on from the garage entry, thus allowing me to just turn on the one light I need anyway if it's dark.
So when I'm away I have it set to turn the lamp on near the time the sun sets, then turn off around my usual bed time. HomeKit is nice and lets me easily turn these automations on or off. Usually during the winter it gets dark anyway so I have another automation that turns the lamp on when I pull into the driveway.
I think that particular outlet is from iDevices and cost something like $40. Worth it imo.