openSenseMap-proxy

A simple proxy with caching for the openSenseMap-API.

Why using it?

Configuration

All configruation is done in /api/config.php:

<?php
$config = array(
  'interval' => 5,            // 5 minutes update interval
  'include_name' => false,    // not including the name in output-json
  'cors' => true,             // will enable CORS
  'senseboxes' => array(
    'weatherstation' => '56957f3ab3de1fe0052532da',
    'dustsensor' => '5ad4cf6d223bd8001939172d'
  )
);

API

http(s)://host/api/?q=weatherstation - Will return a slimmer version of the official API-route for the senseBox with the id 56957f3ab3de1fe0052532da. (Take a look at the configuration.)

Response

{
  "time": 1560608077,
  "sensors": [
    {
      "title": "PM10",
      "unit": "µg/m³",
      "sensortype": "SDS 011",
      "value": "13.87",
      "time": "2019-06-15T14:12:57.407Z"
    },
    {
      "title": "PM2.5",
      "unit": "µg/m³",
      "sensortype": "SDS 011",
      "value": "7.30",
      "time": "2019-06-15T14:12:57.407Z"
    },
    {
      "title": "Temperatur",
      "unit": "°C",
      "sensortype": "DHT22",
      "value": "13.90",
      "time": "2019-06-15T14:12:57.407Z"
    },
    {
      "title": "rel. Luftfeuchte",
      "unit": "%",
      "sensortype": "DHT22",
      "value": "99.90",
      "time": "2019-06-15T14:12:57.407Z"
    }
  ]
}