private void Device_TemperatureChange(object sender, Phidget22.Events.TemperatureSensorTemperatureChangeEventArgs e) { lastSoilTemperature = e.Temperature; lastTimestamp = DateTime.Now; LiveData = lastSoilTemperature.ToString() + " °C"; if ((lastSoilTemperature < minThreshold || lastSoilTemperature > maxThreshold) && !_emailTimer.Enabled) { thresholdBroken?.Invoke(minThreshold, maxThreshold, hubName, SensorType, hubPort, lastSoilTemperature, "broken"); _emailTimer.Enabled = true; } }
private void TemperatureDevice_TemperatureChange(object sender, Phidget22.Events.TemperatureSensorTemperatureChangeEventArgs e) { lastAirTemperature = e.Temperature; lastTimestamp = DateTime.Now; LiveData = lastHumidity.ToString() + " %, " + lastAirTemperature.ToString() + " °C"; if ((lastAirTemperature < secondMinThreshold || lastAirTemperature > secondMaxThreshold) && !_temperatureAlerts.Enabled) { thresholdBroken?.Invoke(minThreshold, maxThreshold, hubName, "Air Temperature", hubPort, lastAirTemperature, "broken"); _temperatureAlerts.Enabled = true; } }