Activitywatch is open source and self-hosted, and written in Python. It's good!
There's even a Rust implementation that's being worked on, it's pretty nice. Still not as convenient as RescueTime though. Doesn't have automatic categorization for example.