コード例 #1
0
ファイル: HomeClient.cs プロジェクト: threax/Threax.Home
        public async Task SetThermostatAsync(String id, ThermostatTempInput command)
        {
            var entry = await entryPointInjector.Load();

            var switches = await entry.ListThermostats(new ThermostatQuery()
            {
                ThermostatId = Guid.Parse(id),
                Limit        = int.MaxValue
            });

            foreach (var sw in switches.Items)
            {
                await sw.SetTemp(command);
            }
        }
コード例 #2
0
        public async Task <Thermostat> SetTemp(Guid thermostatId, [FromBody] ThermostatTempInput tempInput, [FromServices] IThermostatSubsystemManager <ThermostatInput, Thermostat> thermostats)
        {
            var cached = await repo.Get(thermostatId);

            var thermostat = new ThermostatInput();

            thermostat.Bridge    = cached.Bridge;
            thermostat.Subsystem = cached.Subsystem;
            thermostat.Id        = cached.Id;
            thermostat.HeatTemp  = tempInput.HeatTemp;
            thermostat.CoolTemp  = tempInput.CoolTemp;
            thermostat.Fan       = FanSetting.Auto;
            thermostat.Mode      = Mode.Auto;
            await thermostats.Set(thermostat);

            var live = await thermostats.Get(cached.Subsystem, cached.Bridge, cached.Id);

            return(await repo.Update(thermostatId, live));
        }