SmartHome C# code