add temp and humidity from tent, split departures depending on direction

This commit is contained in:
2025-07-30 19:56:19 +02:00
parent ab1d2242c3
commit 09928f0f61
12 changed files with 186 additions and 50 deletions

30
src/api/homeAssistant.ts Normal file
View File

@@ -0,0 +1,30 @@
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkMjQ1OTg0YjliYzE0OTNjYTdmZDJmNTA3ODgzN2U1YSIsImlhdCI6MTc1MzQwMjAzNiwiZXhwIjoyMDY4NzYyMDM2fQ.fnLSFKPdk8lkAEB-4ekdGUJ1PSCBxcAyasQF1PyrD3k";
async function fetchTentHumidity() {
const url = "/api/states/sensor.third_reality_inc_3rths0224z_luftfeuchtigkeit_2";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
}
});
const data = await response.json();
return data.state;
}
async function fetchTentTemperature() {
const url = "/api/states/sensor.third_reality_inc_3rths0224z_temperatur_2";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
}
});
const data = await response.json();
return data.state;
}
export { fetchTentHumidity, fetchTentTemperature };