Data into Database #234
-
Hi, Now comes question: Does someone throw this data into a database to archive it? Thanks a lot upfront. this is the data which I'm using now:
And as well:
Response for tripinfo: trips : [{ Response for status: full status cached : {"vehicleLocation": { |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
Database: It depends on which kind you want to use. I'm not familiar with Synology, so I can't say what would be the easiest interface. In any case you would probably need to create tables for the data you want to store before creating commands to store the data. Extracting a single value: client.on("ready", async () => {
const vehicle = client.getVehicle("********");
const fullStatus = await vehicle.fullStatus({ refresh: false, parsed: false });
const time = fullStatus.vehicleLocation.time;
const fuel = fullStatus.vehicleStatus.fuelLevel;
console.log(`time: ${time}, fuel: ${fuel}`);
}) Also, if you just want to display the latest data on a HTML page, there's no need for a database. |
Beta Was this translation helpful? Give feedback.
-
The result is inside an array, so it should be console.log(response[0].dayRaw); |
Beta Was this translation helpful? Give feedback.
-
Hi, My issue now: For fetchting the data I needed a loop and now I have no idea how to upload data from a loop into the database. Any advice is appreciated. Thanks Code for fetching the data:
Code for write data into mariadb:
|
Beta Was this translation helpful? Give feedback.
Hi,
thanks for the support so far.
With your help I'm able to fetch the data I need and convert into a proper structure. I'm also able to connect to my mariadb on synology.
My issue now: For fetchting the data I needed a loop and now I have no idea how to upload data from a loop into the database.
Any advice is appreciated.
Thanks
Code for fetching the data: