feat: Add logging for received MQTT messages and remove mock data generation in useBedPressureData
This commit is contained in:
parent
9eb57f675b
commit
7e5ed7f26b
3 changed files with 3 additions and 166 deletions
|
@ -1,21 +1,6 @@
|
|||
import { useEffect } from 'react'
|
||||
import { useBedPressureStore, SensorData } from '@/stores/bedPressureStore'
|
||||
|
||||
// Mock data generator
|
||||
const generateTimeSeriesData = (hours = 24) => {
|
||||
const data = []
|
||||
const now = new Date()
|
||||
|
||||
for (let i = hours * 60; i >= 0; i -= 5) {
|
||||
const time = new Date(now.getTime() - i * 60 * 1000)
|
||||
data.push({
|
||||
time: time.toLocaleTimeString("en-US", { hour12: false }),
|
||||
timestamp: time.getTime(),
|
||||
value: Math.floor(Math.random() * 4096 + Math.sin(i / 60) * 500 + 2000), // 0-4095 range
|
||||
})
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
export function useBedPressureData() {
|
||||
const {
|
||||
|
@ -40,8 +25,8 @@ export function useBedPressureData() {
|
|||
sensorConfig.forEach((sensor) => {
|
||||
initialData[sensor.id] = {
|
||||
...sensor,
|
||||
currentValue: Math.floor(Math.random() * 1000 + 1000), // Start with baseline analog value (1000-2000)
|
||||
data: generateTimeSeriesData(),
|
||||
currentValue: 0,
|
||||
data: [],
|
||||
status: "normal",
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue