Fixes float being cast as int
This commit is contained in:
parent
acfd967aee
commit
2cd551f7c5
4 changed files with 5 additions and 4 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue