Refactor sensor ID usage and types, add CO2 metrics, update docs
- Standardize on `sensor.sensor_id` throughout components and stores - Add average and max CO2 metrics to sensor store and HomeView - Improve type safety for sensors, actions, and API calls - Update AGENTS.md with repository guidelines - Refine settings store types and utility functions - Add WindowWithAuth interface for auth store access - Minor bug fixes and code cleanup
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
:content="websocketStore.isConnected ? 'Connected' : 'Disconnected'"
|
||||
/>
|
||||
<MetricCard title="Average Usage" :content="averageEnergyUsage" details="kWh" />
|
||||
<MetricCard title="Average CO2" :content="averageCO2" details="ppm" />
|
||||
<MetricCard title="Max CO2" :content="maxCO2" details="ppm" />
|
||||
<GraphMetricCard
|
||||
title="Real-time Energy"
|
||||
:content="currentEnergyValue"
|
||||
@@ -29,18 +31,6 @@
|
||||
:trend-data="energyStore.energyHistory.slice(-8)"
|
||||
trend-direction="neutral"
|
||||
/>
|
||||
<GraphMetricCard
|
||||
title="Current Knowledge"
|
||||
content="86%"
|
||||
:trend-data="[203, 78, 80, 82, 142, 85, 85, 86]"
|
||||
trend-direction="down"
|
||||
/>
|
||||
<GraphMetricCard
|
||||
title="Knowledge Gain"
|
||||
content="+34%"
|
||||
:trend-data="[20, 25, 28, 30, 32, 33, 34, 34]"
|
||||
trend-direction="neutral"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<RealtimeEnergyChartCard title="Month" />
|
||||
@@ -66,11 +56,13 @@ import SensorConsumptionTable from '@/components/cards/SensorConsumptionTable.vu
|
||||
import RoomMetricsCard from '@/components/cards/RoomMetricsCard.vue'
|
||||
import AirQualityCard from '@/components/cards/AirQualityCard.vue'
|
||||
import { useEnergyStore } from '@/stores/energy'
|
||||
import { useSensorStore } from '@/stores/sensor'
|
||||
import { useSettingsStore } from '@/stores/settings'
|
||||
import { computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useWebSocketStore } from '@/stores/websocket'
|
||||
|
||||
const energyStore = useEnergyStore()
|
||||
const sensorStore = useSensorStore()
|
||||
const websocketStore = useWebSocketStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
@@ -83,6 +75,14 @@ const averageEnergyUsage = computed(() => {
|
||||
return energyStore.averageEnergyUsage.toFixed(2)
|
||||
})
|
||||
|
||||
const averageCO2 = computed(() => {
|
||||
return Math.round(sensorStore.averageCO2Level)
|
||||
})
|
||||
|
||||
const maxCO2 = computed(() => {
|
||||
return Math.round(sensorStore.maxCO2Level)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
settingsStore.initialize()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user