예제 #1
0
        public void Execute()
        {
            var thermostats = Thermostats.Read();
            var thermostat  = thermostats.ThermostatWithSerial(serial);

            if (thermostat == null)
            {
                Console.Error.WriteLine($"Thermostat with serial {serial} not found. Have you run the read command first?");
                Environment.Exit(1);
            }
            var parsedThermostat = new ParsedThermostat(thermostat);

            switch (attributeName)
            {
            case SET_POINT_TEMPERATURE:
                SetSetPointTemperature(thermostat);
                break;

            case VACATION_PERIOD:
                SetVacationPeriod(thermostat);
                break;

            case CANCEL_VACATION:
                CancelVacation(thermostat);
                break;

            default:
                Console.Error.WriteLine($"Only setting {SET_POINT_TEMPERATURE}, {VACATION_PERIOD}, and {CANCEL_VACATION} supported for now");
                Environment.Exit(1);
                break;
            }

            thermostats.Write();
        }
예제 #2
0
파일: Forget.cs 프로젝트: trocken2/Eco2
        public void Execute()
        {
            var thermostats = Thermostats.Read();

            thermostats.RemoveThermostatWithSerial(serial);
            thermostats.Write();
        }
예제 #3
0
        public void Execute()
        {
            var thermostats = Thermostats.Read();

            foreach (var thermostat in thermostats.thermostats)
            {
                Console.WriteLine(thermostat.Serial);
            }
        }
예제 #4
0
파일: Write.cs 프로젝트: trocken2/Eco2
        public Write(string serial, IBluetooth bluetooth)
        {
            this.serial = serial;
            thermostats = Thermostats.Read();
            accessor    = new PeripheralAccessor(bluetooth);

            if (!thermostats.HasSecretAndUuidFor(serial))
            {
                Console.Error.WriteLine($"Has not previously connected to {serial}. Do a read first.");
                Environment.Exit(1);
            }
        }
예제 #5
0
        public void Execute()
        {
            var thermostats = Thermostats.Read();
            var thermostat  = thermostats.ThermostatWithSerial(serial);

            if (thermostat == null)
            {
                Console.Error.WriteLine($"Thermostat with serial {serial} not found. Have you run the read command first?");
                Environment.Exit(1);
            }

            var parsed = new ParsedThermostat(thermostat);

            Console.WriteLine($"Device name: {parsed.DeviceName}");
            Console.WriteLine($"Device UUID: {thermostat.Uuid}");
            Console.WriteLine($"Battery level: {parsed.BatteryLevelPercent}%");
            Console.WriteLine("");
            Console.WriteLine($"Set-point/room temperature: {parsed.SetPointTemperature} / {parsed.RoomTemperature}");
            Console.WriteLine($"Home/away temperature: {parsed.HomeTemperature} / {parsed.AwayTemperature}");
            Console.WriteLine($"Vacation/frost protection temperature: {parsed.VacationTemperature} / {parsed.FrostProtectionTemperature}");
            Console.WriteLine($"Schedule mode: {parsed.ScheduleMode}");
            if (parsed.VacationFrom != null && parsed.VacationTo != null)
            {
                Console.WriteLine($"Vacation: {parsed.VacationFrom} - {parsed.VacationTo}");
            }
            Console.WriteLine("");
            Console.WriteLine($"Monday:\n{parsed.MondaySchedule}");
            Console.WriteLine("");
            Console.WriteLine($"Tuesday:\n{parsed.TuesdaySchedule}");
            Console.WriteLine("");
            Console.WriteLine($"Wednesday:\n{parsed.WednesdaySchedule}");
            Console.WriteLine("");
            Console.WriteLine($"Thursday:\n{parsed.ThursdaySchedule}");
            Console.WriteLine("");
            Console.WriteLine($"Friday:\n{parsed.FridaySchedule}");
            Console.WriteLine("");
            Console.WriteLine($"Saturday:\n{parsed.SaturdaySchedule}");
            Console.WriteLine("");
            Console.WriteLine($"Sunday:\n{parsed.SundaySchedule}");

            if (thermostat.HasUpdatedAttributes)
            {
                Console.WriteLine("");
                Console.WriteLine("Attributes to be updated:");
                if (thermostat.UpdatedSetPointTemperature != null)
                {
                    Console.WriteLine($"Set-point temperature: {thermostat.UpdatedSetPointTemperature}");
                }
                if (thermostat.HasUpdatedVacationPeriod)
                {
                    if (thermostat.UpdatedVacationPeriod != null)
                    {
                        Console.WriteLine($"Vacation: {thermostat.UpdatedVacationPeriod.From} - {thermostat.UpdatedVacationPeriod.To}");
                    }
                    else
                    {
                        Console.WriteLine("Clear upcoming vacation period");
                    }
                }
            }
        }
예제 #6
0
파일: Read.cs 프로젝트: trocken2/Eco2
 public Read(string serial, IBluetooth bluetooth)
 {
     this.serial = serial;
     thermostats = Thermostats.Read();
     accessor    = new PeripheralAccessor(bluetooth);
 }