A Multiagent System Approach to Scheduling Devices in Smart Homes