A (hopefully soon) fully featured selft-hosted web interface and server-backend to store weather data (comparable to opensensemap.org)
Find a file
2019-07-30 13:42:08 +02:00
api added new maxVals modes (see README.md) 2019-07-30 13:07:49 +02:00
css - moved all remote sources to local ones 2019-07-30 13:42:08 +02:00
img added installation instructions 2019-07-27 13:41:48 +02:00
js - moved all remote sources to local ones 2019-07-30 13:42:08 +02:00
blueweather.code-workspace added installation instructions 2019-07-27 13:41:48 +02:00
dashboard.html - moved all remote sources to local ones 2019-07-30 13:42:08 +02:00
index.html - moved all remote sources to local ones 2019-07-30 13:42:08 +02:00
login.html added installation instructions 2019-07-27 13:41:48 +02:00
loginmodal.html added installation instructions 2019-07-27 13:41:48 +02:00
loginmodal2.html - added new measvalue submit api 2019-07-29 00:24:01 +02:00
README.md added new maxVals spec 2019-07-30 13:08:00 +02:00

BlueWeather

A (hopefully soon) fully featured selft-hosted web interface and server-backend to store weather data (comparable to opensensemap.org)

State of development

  • interface and backend planned
  • readonly dashboard is working

Installation

  1. Install the required packages
sudo apt install git apache2 mysql-server mysql-client php libapache2-mod-php php-mysql php-cli php-common -y
  1. Prepare the working directory and download SafeMail
cd /var/www/html/

git clone https://git.itsblue.de/dorian/blueweather.git
  1. Create the database
sudo mysql -u root

CREATE DATABASE blueweather;
  1. now create the database user, if you change the username, password or database name, don't forget to change that data in the config.php file!
GRANT ALL ON blueweather.* TO 'blueweather'@'localhost' IDENTIFIED BY 'root';

FLUSH PRIVILEGES;

exit;
  1. Prepare database for usage (create Tables and Keys)
cd /var/www/html/blueweather/api

sudo mysql -u root blueweather < blueweather.sql

Your BlueWeather instance can now be reached under: <your_ip>/blueweather

API docs

get locations

triggered by setting no GET parameter at all

Parameters

no parameters

Tags

  • id
  • locationname
  • latitude
  • longitude
  • countryname

get location data

triggered by setting GET parameter 'locId' to a vaild location id

Parameters

  • locId: id of the location to display
  • range: range of the data to display in unix time
    • from
    • to
  • max vals:
    • count: maximum measvals to be transmitted
    • mode: can be:
      • 'newest': will return the newest values
      • 'oldest': will return the oldest values
      • 'avg' : sub avarages will be calculated

Tags

  • id
  • locationname
  • latitude
  • longitude
  • countryname
  • measvalues
    • measvalue
    • sensorid
    • timestamp
  • sensors
    • id
    • added
    • userid
    • sensorname
    • property ('indoor' || 'sunny' || 'shadow')
    • valuetypeid
  • valuetypes
    • id
    • valuetype ('temperature' || 'humidity' || 'pressure' || 'fine dust')
    • valueunit (html coding)
    • displayproperty
      • widget (properties for small widget)
        • type ('doughnut' || 'text')
        • properties (chartjs dataset properties if type is a chartjs type)
      • chart (properties for large chart)
        • type ('scatter')
        • properties (chartjs dataset properties)
  • range (actual range of present measvalues)
    • from
    • to

submit sensor data

triggered by setting POST parameter 'submitSensorData' to a JSON encoded string containing the request

Request

  • identity: identity of the api token (given by webinterface)
  • signature: hash_hmac with SHA256 of 'data' string with an API-key as key
  • data: JSON array[array[
    sensorId,
    measvalue,
    timestamp
    ]]
    CAUTION!! This MUST be a string and NOT direct JSON!!

Reply

  • status:
    • 200: was inserted
    • 400: format of request was wrong
    • 401: signture verify failed
    • 404: key identity was not found
    • 500: internal error
    • 900: format of data JSON string was invalid
    • 901: signature was fine but one or more sensors have been ignored due to some error (see 'data') all other sensors were processes successfully
  • data: Array[Array[sensorId, errorCode]] sensors which were ignored due to some error (401: user doesn't own sensor; 404: senso wasn't found) only set if status is 901