Enhancing Residential Energy Sustainability with Occupancy Detection and AI-based Trading