LoRaStore Backend

Documentation for LoRaStore Backend

Database schematic

Logo

Browse DB Schema at dbdiagram.io: LoRaStore Diagram

Table sensors {
SensorId  int
SensorName  varchar
SensorPassword  varchar
SensorDescription  varchar
}

Table Measurement {
MeasurementId  int
MeasurementDate  datetime
Value  double
SensorId  int
}

Ref: "sensors"."SensorId" < "Measurement"."SensorId"

API

Add measurement record to DB

Prepare and send HTTP POST application/json request to addres: https://lorastore20181206101456.azurewebsites.net/api/Measurements

{ 
    "SensorId": 1,  //Int
    "Value": 124.23, // Double
    "SensorPassword": "Password" //String
}

Try Python script for interval POST requests:

import urllib.request
# if err run in cmd: pip3 install urllib3
from random import randint
import json    
import time
_login = 20 # Your SensorId
_password = "password_there!!!!!!"
for x in range(100):
    print("############################################")
    temp = 10 + (randint(0, 200)/10)
    body =  { "SensorId": _login, "Value":temp, "SensorPassword":_password}
    myurl = "https://lorastore20181206101456.azurewebsites.net/api/Measurements"
    req = urllib.request.Request(myurl)
    req.add_header('Content-Type', 'application/json; charset=utf-8')
    jsondata = json.dumps(body)
    jsondataasbytes = jsondata.encode('utf-8')   # needs to be bytes
    req.add_header('Content-Length', len(jsondataasbytes))
    print (jsondataasbytes)
    response = urllib.request.urlopen(req, jsondataasbytes)
    print(response.msg)
    print(response.status)
    print(response.read() )
    print("WAIT...")
    time.sleep(10)   

Get list of each records for one sensor

Request HTTP GET: https://lorastore20181206101456.azurewebsites.net/api/Measurements?id=<ID>
(Replace ID) ExampleHTTP GET: https://lorastore20181206101456.azurewebsites.net/api/Measurements?id=36
Test: Get list of measurements from SensorID=36

an example of an answer to the query

Logo

Sensors management

(only for application administrator)

Login

Logo

Sensors management

Logo

Sensors editor

Logo

Deploy LoRaStore at Your server

You can deploy LoRaStore solution and database at Your server (hosted on azure (or other cloud) or at home).
For this, You need:
LoraStore Solution: LoRaStore Repositorium
Instruction: Host and deploy ASP.NET Core

Deploy Dashboard at Your server

You can deploy LoRaStore solution and database at Your server (hosted on azure (or other cloud) or at home).
For this, You need:
Dashboard Repositorium: LoRaStore Repositorium
Instruction: How to deploy Your page to GitHub Pages