mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-13 17:22:54 -05:00
Separate historical from current
This commit is contained in:
@@ -19,11 +19,17 @@
|
|||||||
density="compact"
|
density="compact"
|
||||||
nav>
|
nav>
|
||||||
<v-list-item
|
<v-list-item
|
||||||
prepend-icon="mdi-view-dashboard"
|
prepend-icon="mdi-information-outline"
|
||||||
title="Dashboard"
|
title="Current"
|
||||||
to="/"
|
to="/"
|
||||||
@click="drawer = false">
|
@click="drawer = false">
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
<v-list-item
|
||||||
|
prepend-icon="mdi-chart-box-outline"
|
||||||
|
title="Summary"
|
||||||
|
to="summary"
|
||||||
|
@click="drawer = false">
|
||||||
|
</v-list-item>
|
||||||
<v-list-item
|
<v-list-item
|
||||||
prepend-icon="mdi-sun-thermometer"
|
prepend-icon="mdi-sun-thermometer"
|
||||||
title="Outdoor"
|
title="Outdoor"
|
||||||
|
|||||||
@@ -71,8 +71,10 @@
|
|||||||
<td>{{ ConvertMillibarToInchesOfMercury(indoorStore.current.pressure).toFixed(2) }}"</td>
|
<td>{{ ConvertMillibarToInchesOfMercury(indoorStore.current.pressure).toFixed(2) }}"</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td className="header">Air Quality</td>
|
<td className="header">Air quality</td>
|
||||||
<td :class="airQualityClass(indoorStore.current.airQualityIndex)" :title="indoorStore.current.airQualityIndex.toString()">
|
<td
|
||||||
|
:class="airQualityClass(indoorStore.current.airQualityIndex)"
|
||||||
|
:title="indoorStore.current.airQualityIndex.toString()">
|
||||||
{{ airQualityDescription(indoorStore.current.airQualityIndex) }}
|
{{ airQualityDescription(indoorStore.current.airQualityIndex) }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,24 +1,35 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { useWeatherStore } from '@/stores/weatherStore';
|
import { useWeatherStore } from '@/stores/weatherStore';
|
||||||
import { subHours } from 'date-fns';
|
|
||||||
import WeatherAggregates from '@/models/weather/weather-aggregates';
|
import WeatherAggregates from '@/models/weather/weather-aggregates';
|
||||||
import { ConvertPascalToInchesOfMercury } from '@/pressureConverter';
|
import { ConvertPascalToInchesOfMercury } from '@/pressureConverter';
|
||||||
|
import { ShortenWindDirection } from '@/windFormatter';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
start: { type: Date, required: true },
|
||||||
|
end: { type: Date, required: true }
|
||||||
|
});
|
||||||
|
|
||||||
const weatherAggregates = ref<WeatherAggregates | undefined>();
|
const weatherAggregates = ref<WeatherAggregates | undefined>();
|
||||||
|
|
||||||
const weatherStore = useWeatherStore();
|
const weatherStore = useWeatherStore();
|
||||||
|
|
||||||
const end = new Date();
|
weatherStore.getReadingAggregate(props.start, props.end).then((newWeatherAggregates) => {
|
||||||
const start = subHours(end, 24);
|
|
||||||
|
|
||||||
weatherStore.getReadingAggregate(start, end).then((newWeatherAggregates) => {
|
|
||||||
weatherAggregates.value = newWeatherAggregates;
|
weatherAggregates.value = newWeatherAggregates;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [props.start, props.end],
|
||||||
|
() => {
|
||||||
|
weatherStore.getReadingAggregate(props.start, props.end).then((newWeatherAggregates) => {
|
||||||
|
weatherAggregates.value = newWeatherAggregates;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DashboardItem title="Weather Summary">
|
<DashboardItem title="Weather">
|
||||||
<div className="weather-summary">
|
<div className="weather-summary">
|
||||||
<div v-if="!weatherAggregates">Loading...</div>
|
<div v-if="!weatherAggregates">Loading...</div>
|
||||||
<table v-else>
|
<table v-else>
|
||||||
@@ -81,7 +92,7 @@
|
|||||||
<td class="weather-summary-header">Wind direction</td>
|
<td class="weather-summary-header">Wind direction</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
{{ weatherAggregates!.windDirectionAverage }}
|
{{ ShortenWindDirection(weatherAggregates!.windDirectionAverage) }}
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
import WindDirection from './wind-direction';
|
||||||
|
|
||||||
export default interface WeatherAggregates {
|
export default interface WeatherAggregates {
|
||||||
humidity: WeatherAggregate;
|
humidity: WeatherAggregate;
|
||||||
temperature: WeatherAggregate;
|
temperature: WeatherAggregate;
|
||||||
pressure: WeatherAggregate;
|
pressure: WeatherAggregate;
|
||||||
light: WeatherAggregate;
|
light: WeatherAggregate;
|
||||||
windSpeed: WeatherAggregate;
|
windSpeed: WeatherAggregate;
|
||||||
windDirectionAverage: number;
|
windDirectionAverage: WindDirection;
|
||||||
rainTotal: number;
|
rainTotal: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup></script>
|
||||||
import CurrentWeather from '../components/CurrentWeather.vue';
|
|
||||||
import CurrentPower from '../components/CurrentPower.vue';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-container
|
<v-container
|
||||||
@@ -19,9 +16,6 @@
|
|||||||
<v-card class="current-laundry-status">
|
<v-card class="current-laundry-status">
|
||||||
<CurrentLaundryStatus></CurrentLaundryStatus>
|
<CurrentLaundryStatus></CurrentLaundryStatus>
|
||||||
</v-card>
|
</v-card>
|
||||||
<v-card class="weather-summary">
|
|
||||||
<WeatherSummary></WeatherSummary>
|
|
||||||
</v-card>
|
|
||||||
<v-card class="upstairs">
|
<v-card class="upstairs">
|
||||||
<Indoor
|
<Indoor
|
||||||
title="Upstairs"
|
title="Upstairs"
|
||||||
@@ -41,35 +35,45 @@
|
|||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 700px) {
|
@media (min-width: 1024px) {
|
||||||
.container {
|
.container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(5, max-content);
|
grid-template-columns: repeat(5, max-content);
|
||||||
grid-template-rows: repeat(5, max-content);
|
grid-template-rows: repeat(3, max-content);
|
||||||
gap: 15px 15px;
|
gap: 15px 15px;
|
||||||
grid-auto-flow: row;
|
grid-auto-flow: row;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
'current-weather current-weather almanac almanac current-power'
|
'current-weather current-weather almanac almanac current-power'
|
||||||
'current-weather current-weather almanac almanac current-laundry-status'
|
'current-weather current-weather almanac almanac current-laundry-status'
|
||||||
'weather-summary weather-summary weather-summary upstairs downstairs'
|
'upstairs downstairs . . .';
|
||||||
'weather-summary weather-summary weather-summary . .'
|
|
||||||
'. . . . .';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 1024px) {
|
||||||
.container {
|
.container {
|
||||||
padding: 7px;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(1, max-content);
|
grid-template-columns: repeat(4, max-content);
|
||||||
grid-template-rows: repeat(7, max-content);
|
grid-template-rows: repeat(3, max-content);
|
||||||
|
gap: 15px 15px;
|
||||||
|
grid-auto-flow: row;
|
||||||
|
grid-template-areas:
|
||||||
|
'current-weather current-weather almanac almanac'
|
||||||
|
'current-weather current-weather almanac almanac'
|
||||||
|
'current-power current-laundry-status upstairs downstairs';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(1, 1fr);
|
||||||
|
grid-template-rows: repeat(6, max-content);
|
||||||
gap: 10px 0px;
|
gap: 10px 0px;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
'current-weather'
|
'current-weather'
|
||||||
'almanac'
|
'almanac'
|
||||||
'current-power'
|
'current-power'
|
||||||
'current-laundry-status'
|
'current-laundry-status'
|
||||||
'weather-summary'
|
|
||||||
'upstairs'
|
'upstairs'
|
||||||
'downstairs';
|
'downstairs';
|
||||||
}
|
}
|
||||||
@@ -91,10 +95,6 @@
|
|||||||
grid-area: current-laundry-status;
|
grid-area: current-laundry-status;
|
||||||
}
|
}
|
||||||
|
|
||||||
.weather-summary {
|
|
||||||
grid-area: weather-summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upstairs {
|
.upstairs {
|
||||||
grid-area: upstairs;
|
grid-area: upstairs;
|
||||||
}
|
}
|
||||||
|
|||||||
82
WebDisplay/src/pages/summary.vue
Normal file
82
WebDisplay/src/pages/summary.vue
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { subHours } from 'date-fns';
|
||||||
|
import TimeSpan from '@/models/time-span';
|
||||||
|
import TimeRange from '@/components/TimeRange.vue';
|
||||||
|
import WeatherSummary from '@/components/WeatherSummary.vue';
|
||||||
|
|
||||||
|
const end = ref(new Date());
|
||||||
|
const start = ref(subHours(end.value, 24));
|
||||||
|
const timeSpan = ref(TimeSpan.Last24Hours);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<v-container
|
||||||
|
fluid
|
||||||
|
class="container">
|
||||||
|
<TimeRange
|
||||||
|
:time-span="timeSpan"
|
||||||
|
:start="start"
|
||||||
|
:end="end"
|
||||||
|
@change="
|
||||||
|
(value) => {
|
||||||
|
timeSpan = value.timeSpan;
|
||||||
|
start = value.start;
|
||||||
|
end = value.end;
|
||||||
|
}
|
||||||
|
"></TimeRange>
|
||||||
|
<v-card class="weather-summary">
|
||||||
|
<WeatherSummary
|
||||||
|
:start="start"
|
||||||
|
:end="end"></WeatherSummary>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1024px) {
|
||||||
|
.container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, max-content);
|
||||||
|
grid-template-rows: repeat(2, max-content);
|
||||||
|
gap: 15px 15px;
|
||||||
|
grid-auto-flow: row;
|
||||||
|
grid-template-areas:
|
||||||
|
'weather-summary weather-summary weather-summary'
|
||||||
|
'weather-summary weather-summary weather-summary';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, max-content);
|
||||||
|
grid-template-rows: repeat(2, max-content);
|
||||||
|
gap: 15px 15px;
|
||||||
|
grid-auto-flow: row;
|
||||||
|
grid-template-areas:
|
||||||
|
'weather-summary weather-summary weather-summary'
|
||||||
|
'weather-summary weather-summary weather-summary';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.container {
|
||||||
|
padding: 7px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(1, max-content);
|
||||||
|
grid-template-rows: repeat(1, max-content);
|
||||||
|
gap: 10px 0px;
|
||||||
|
grid-template-areas: 'weather-summary';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-summary {
|
||||||
|
grid-area: weather-summary;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import WindDirection from './models/weather/wind-direction';
|
import WindDirection from './models/weather/wind-direction';
|
||||||
|
import WindDirectionNumber from './models/weather/wind-direction-number';
|
||||||
|
|
||||||
export function ShortenWindDirection(windDirection: WindDirection | undefined): string {
|
export function ShortenWindDirection(windDirection: WindDirection | undefined): string {
|
||||||
switch (windDirection) {
|
switch (windDirection) {
|
||||||
@@ -39,3 +40,43 @@ export function ShortenWindDirection(windDirection: WindDirection | undefined):
|
|||||||
}
|
}
|
||||||
return windDirection!.toString();
|
return windDirection!.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ShortenWindDirectionNumber(windDirection: WindDirectionNumber | undefined): string {
|
||||||
|
switch (windDirection) {
|
||||||
|
case WindDirectionNumber.None:
|
||||||
|
return '';
|
||||||
|
case WindDirectionNumber.North:
|
||||||
|
return 'N';
|
||||||
|
case WindDirectionNumber.East:
|
||||||
|
return 'E';
|
||||||
|
case WindDirectionNumber.South:
|
||||||
|
return 'S';
|
||||||
|
case WindDirectionNumber.West:
|
||||||
|
return 'W';
|
||||||
|
case WindDirectionNumber.NorthEast:
|
||||||
|
return 'NE';
|
||||||
|
case WindDirectionNumber.SouthEast:
|
||||||
|
return 'SE';
|
||||||
|
case WindDirectionNumber.SouthWest:
|
||||||
|
return 'SW';
|
||||||
|
case WindDirectionNumber.NorthWest:
|
||||||
|
return 'NW';
|
||||||
|
case WindDirectionNumber.NorthNorthEast:
|
||||||
|
return 'NNE';
|
||||||
|
case WindDirectionNumber.EastNorthEast:
|
||||||
|
return 'ENE';
|
||||||
|
case WindDirectionNumber.EastSouthEast:
|
||||||
|
return 'ESE';
|
||||||
|
case WindDirectionNumber.SouthSouthEast:
|
||||||
|
return 'SSE';
|
||||||
|
case WindDirectionNumber.SouthSouthWest:
|
||||||
|
return 'SSW';
|
||||||
|
case WindDirectionNumber.WestSouthWest:
|
||||||
|
return 'WSW';
|
||||||
|
case WindDirectionNumber.WestNorthWest:
|
||||||
|
return 'WNW';
|
||||||
|
case WindDirectionNumber.NorthNorthWest:
|
||||||
|
return 'NNW';
|
||||||
|
}
|
||||||
|
return windDirection!.toString();
|
||||||
|
}
|
||||||
|
|||||||
1
WebDisplay/typed-router.d.ts
vendored
1
WebDisplay/typed-router.d.ts
vendored
@@ -43,6 +43,7 @@ declare module 'vue-router/auto/routes' {
|
|||||||
'/indoor': RouteRecordInfo<'/indoor', '/indoor', Record<never, never>, Record<never, never>>,
|
'/indoor': RouteRecordInfo<'/indoor', '/indoor', Record<never, never>, Record<never, never>>,
|
||||||
'/outdoor': RouteRecordInfo<'/outdoor', '/outdoor', Record<never, never>, Record<never, never>>,
|
'/outdoor': RouteRecordInfo<'/outdoor', '/outdoor', Record<never, never>, Record<never, never>>,
|
||||||
'/power': RouteRecordInfo<'/power', '/power', Record<never, never>, Record<never, never>>,
|
'/power': RouteRecordInfo<'/power', '/power', Record<never, never>, Record<never, never>>,
|
||||||
|
'/summary': RouteRecordInfo<'/summary', '/summary', Record<never, never>, Record<never, never>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user