Light level changes

This commit is contained in:
2021-05-28 20:27:03 -04:00
parent 3ccadd58c6
commit de95ec18a5
4 changed files with 4 additions and 12 deletions

View File

@@ -126,15 +126,7 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Data
var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueHistoryGrouped.sql"); var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueHistoryGrouped.sql");
switch (weatherValueType) query = query.Replace("@Value", weatherValueType.ToString());
{
case WeatherValueType.LightLevel:
query = query.Replace("@Value", "LightLevel / 3.3 * 100");
break;
default:
query = query.Replace("@Value", weatherValueType.ToString());
break;
}
return await connection.QueryAsync<WeatherValueGrouped>(query, new { Start = start, End = end, BucketMinutes = bucketMinutes }); return await connection.QueryAsync<WeatherValueGrouped>(query, new { Start = start, End = end, BucketMinutes = bucketMinutes });
} }

View File

@@ -11,7 +11,7 @@ FROM (
Humidity, Humidity,
PressureTemperature AS Temperature, PressureTemperature AS Temperature,
Pressure, Pressure,
LightLevel / 3.3 * 100 AS LightLevel, LightLevel,
Rain Rain
FROM Reading FROM Reading
WHERE Timestamp BETWEEN @Start AND @End WHERE Timestamp BETWEEN @Start AND @End

View File

@@ -36,7 +36,7 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Models
Pressure = new ReadingAggregate(readings, r => r.Pressure, 2); Pressure = new ReadingAggregate(readings, r => r.Pressure, 2);
Light = new ReadingAggregate(readings, r => (r.LightLevel / 3.3m * 100).Truncate(1), 1); Light = new ReadingAggregate(readings, r => r.LightLevel, 2);
WindSpeed = new ReadingAggregate(readings, r => r.WindSpeed, 1); WindSpeed = new ReadingAggregate(readings, r => r.WindSpeed, 1);

View File

@@ -25,7 +25,7 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Models
Rain = weatherMessage.Rain; Rain = weatherMessage.Rain;
Pressure = weatherMessage.Pressure; Pressure = weatherMessage.Pressure;
Temperature = weatherMessage.PressureTemperature; Temperature = weatherMessage.PressureTemperature;
LightLevel = weatherMessage.LightLevel / 3.3m * 100; LightLevel = weatherMessage.LightLevel;
Latitude = weatherMessage.Latitude; Latitude = weatherMessage.Latitude;
Longitude = weatherMessage.Longitude; Longitude = weatherMessage.Longitude;
Altitude = weatherMessage.Altitude; Altitude = weatherMessage.Altitude;