Storing data on SD card via script and sending data from card to cloud database

We have created a script that posts data from the eWON tags to a cloud database. This is sufficient so long as the eWON maintains its internet connection. Data is lost if the connection is lost for a period of time.

I seen some posts that indicate a script may be used to store data to the SD card on the eWON. Can a script be used to push the data from the SD card to the cloud database?

Alternatively, can data be stored to an external hard drive via a script on the eWON?

Hello Dean,

Hello, you may have a script save files to the SD card and perform an FTP process to send it the cloud. We have not had any evidence that a external hardive will work with what you require. Mosts times, the USB is used for configuration.

What is the connection method of the eWON device.

The eWON is currently connected to the internet via a maintained cellular modem connection. We know at times, in some locations, the connection can be interrupted for brief periods of time.

Based on your reply I understand the data may be written to the SD card. Using a script, may the data also be read from the card, parsed and pushed to the cloud? We currently have a script using REQUESTHTTPX with the POST method to send the tag name and value to a time series database. We would like to create a cache, of sorts, at the eWON to the data may be held for a time in case the internet connection is interrupted. Once the connection is re-established the data can then be pushed to the cloud.

Hello,

You can do an ONCHANGE checking for WAN connectivity. Once the connectivity is lost, it will create a file to save to the SD card. Once the connectivity restores, check for a file and either send it through FTP or email to the server.

I have successfully tested the script to write data to a text file on the SD card in the eWON. I am now trying to send that file to the time series database via the REQUESTHTTPX command.

url$ = <<URL of database>>
method$ = "POST"
REQUESTHTTPX url$, method$, "", "[saveddata.txt]"

The logs reqport “httpc-text field syntax error in puthttp command” when executing the above code.

I then try this code:

url$ = <<URL of database>>
method$ = "POST"
header$ = "Content-Type=text/plain"
REQUESTHTTPX url$, method$, header$, "[saveddata.txt]"

And the response is “400 Bad Request”.

I believe the time series database requires the header to indicate the file being sent is a binary type but I cannot find any documentation on what exactly the header should be.

I have discovered the issue with the REQUESTHTTPX formulation is I was not using the Export Block Descriptor. My command now appears thus:

REQUESTHTTPX url$, method$, header$, “”, “[$dtUF$ufsaveddata.txt]”

When I execute the command I receive a ‘204’ response code from the database, which is the expected response, and the response headers appear properly as well. However, the data is not being written to the database. I receive no other indication that the write failed.

I used the EBD Helper tool to test the File-Data portion of my command and was able to successfully export the file from my eWON to my laptop.

So, there seems to be an issue with database and how it receives the file.

Thank you for the update on the status of your issue.

I am glad the ewon device is exporting the the correct data, in the correct format.

Topic closed due to inactivity.