add temp and humidity from tent, split departures depending on direction
This commit is contained in:
30
src/api/homeAssistant.ts
Normal file
30
src/api/homeAssistant.ts
Normal 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 };
|
||||
Reference in New Issue
Block a user