Skip to content

Commit 799b63e

Browse files
committed
Fix heaters duty detection on frontend
1 parent 3b3886c commit 799b63e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

web/src/features/sensors/heaters/heatersSlice.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ export const setHeaterAsync = createAsyncThunk(
1818
async ({index, heater}) => await setHeater(index, heater)
1919
)
2020

21+
const transformDuty = heater => {
22+
return {...heater, duty: heater.active ? heater.duty : 0}
23+
}
2124
const addHeatersToHistory = (state) => {
22-
state.history = [...state.history, { timestamp: new Date().getTime(), heaters: state.heaters }].slice(-1000)
25+
state.history = [...state.history, { timestamp: new Date().getTime(), heaters: state.heaters.map(transformDuty) }].slice(-1000)
2326
}
2427
const onHeatersReceived = (state, payload) => {
2528
state.heaters = payload;

0 commit comments

Comments
 (0)