Fixes float being cast as int

This commit is contained in:
Michel Fedde 2025-08-16 19:54:18 +02:00
parent acfd967aee
commit 2cd551f7c5
4 changed files with 5 additions and 4 deletions

View file

@ -3,8 +3,8 @@ import dotenv from 'dotenv';
import * as fs from "node:fs";
import {Agent} from "undici";
if (fs.existsSync(".env.dist")) {
dotenv.config({ path: '.env.dist'});
if (fs.existsSync(".env")) {
dotenv.config({ path: '.env'});
}
const URI = `${process.env.DOMAIN}/api/states`;
@ -25,7 +25,7 @@ async function getSensorValue(sensor: string): Promise<number> {
return -1;
}
const data: unknown = await result.json();
return parseInt(data.state);
return parseFloat(data.state);
}
const server = express()