33 lines
938 B
TypeScript
33 lines
938 B
TypeScript
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 };
|