add temp and humidity from tent, split departures depending on direction
This commit is contained in:
28
src/store/homeAssistant.ts
Normal file
28
src/store/homeAssistant.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { create } from "zustand";
|
||||
import { devtools } from "zustand/middleware";
|
||||
import { fetchTentHumidity, fetchTentTemperature } from "@/api/homeAssistant";
|
||||
|
||||
const useHomeAssistantStore = create(
|
||||
devtools(
|
||||
(set) => ({
|
||||
tentTemperature: 0,
|
||||
tentHumidity: 0,
|
||||
fetch: async () => {
|
||||
const [temperature, humidity] = await Promise.all([
|
||||
fetchTentTemperature(),
|
||||
fetchTentHumidity(),
|
||||
]);
|
||||
|
||||
set({
|
||||
tentTemperature: temperature,
|
||||
tentHumidity: humidity,
|
||||
});
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "home-assistant-store",
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
export { useHomeAssistantStore };
|
||||
Reference in New Issue
Block a user