Files
monitor-im-flur/src/api/homeAssistant.ts
T
arif af3277e5c7
CI / build (push) Successful in 9s
CI / lint (push) Successful in 9s
CI / create-and-publish-docker-image (push) Successful in 42s
fix biome
2025-12-19 15:55:11 +01:00

43 lines
994 B
TypeScript

const token = import.meta.env.VITE_HA_TOKEN;
async function fetchTentHumidity() {
if (!token) {
console.error("HA token not found");
return;
}
const url = `https://home.rivercry.com/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() {
if (!token) {
console.error("HA token not found");
return;
}
const url = `https://home.rivercry.com/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 };