Refactor to decouple energy, room, and sensor stores

- Remove room and sensor logic from energy store - Update components to
use useRoomStore and useSensorStore directly - Fix sensor/room ID
mismatches and API response handling in room store - Update
AIOptimizationView to use useWebSocketStore for connection status -
Update SensorManagementView to use useRoomStore and useSensorStore
directly
This commit is contained in:
rafaeldpsilva
2025-10-01 12:26:44 +01:00
parent 71d1d82761
commit b9348140b8
8 changed files with 97 additions and 115 deletions

View File

@@ -70,12 +70,12 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useEnergyStore } from '@/stores/energy'
import { useRoomStore } from '@/stores/room'
const energyStore = useEnergyStore()
const roomStore = useRoomStore()
const roomsList = computed(() => {
return Array.from(energyStore.roomsData.values()).sort((a, b) =>
return Array.from(roomStore.roomsData.values()).sort((a, b) =>
b.co2.current - a.co2.current // Sort by CO2 level descending
)
})
@@ -86,7 +86,7 @@ const overallCO2 = computed(() => {
})
const overallStatus = computed(() => {
return energyStore.getCO2Status(overallCO2.value)
return roomStore.getCO2Status(overallCO2.value)
})
const roomsWithGoodAir = computed(() => {