Accurate Detection of IoT Sensor Behaviors in Legitimate, Faulty and Compromised Scenarios