mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-13 17:22:54 -05:00
Light level changes
This commit is contained in:
@@ -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 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user