Пример #1
0
        public async Task CheckAsync()
        {
            if (_thermostatConfig.Mode == ThermostatModes.Off)
            {
                return;
            }

            var currentTemperature = await _temperatureService.GetCurrentAsync();

            var setpoint   = _thermostatConfig.Setpoint;
            var hysteresis = _thermostatConfig.Hysteresis;

            if (currentTemperature - hysteresis >= setpoint)
            {
                await _relayService.PowerOffAsync();
            }
            else if (await _relayService.GetStatusAsync() == RelayStatuses.Off)
            {
                await _relayService.PowerOnAsync();
            }

            PrintResult(currentTemperature,
                        setpoint,
                        hysteresis);
        }