Endpoint Scripts

PHP scripts for the JSON generation and the status display page
Alternatives To Endpoint Scripts
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Esp Mqtt Json Multisensor304
4 years ago39apache-2.0C++
(OBSOLETE) ESP MQTT JSON Multisensor for Home Assistant. Supported sensors include the TEMT6000 light, AM312 PIR, DHT22 temperature/humidity sensors. RGB led supports flash, fade, and transition. Over-The-Air (OTA) uploading, too!
Ha Hpprinter62
10 months ago8Python
HP Printer Integration
2 years agomitPHP
Interface for controlling the temperature sensors DS18B20, supports; serial DS9097, usb DS9097U, usb DS2490, Raspberry Pi GPIO
C Json Path14
8 years agomitC
Basic Pure C implementation of XPath like query library for JSON-data. No allocs, No c++. Suitable to microcontrollers and sensors.
Ext Processor Sample12
4 years agoJava
Smartthings Capabilities11
6 days ago
SmartThings Capabilities
6 years agomitPython
A Fusion360 add-in for generating SteamVR Tracking JSON files from 3D CAD Data
Endpoint Scripts8
9 years ago4PHP
PHP scripts for the JSON generation and the status display page
Kafka Sensors8
2 years agoapache-2.0Java
Kafka Serialization Playground
a year ago1apache-2.0C
PMS5003 air quality sensor data grabbing in C, to JSON, on Linux, with averaging over time
Alternatives To Endpoint Scripts
Select To Compare

Alternative Project Comparisons

SpaceAPI Endpoint And Status Script

The provided scripts are for generating the JSON but also for displaying the space status.

Given the following apache configuration,

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/srv/http/spaceapi"
    ServerName spaceapi.your-space.com
    <Directory />
        AllowOverride ALL

the scripts are in /srv/http/spaceapi while the following URLs are now available:

If you deploy the endpoint scripts by cloning the repo, you should forbid public access to the .git directory. If you're using Apache as the web server with the module rewrite enabled, you don't need to do anything, .htaccess is already protecting it.


There's not much to say. Simply adapt spaceapi.json to your needs and add here your URL http://spaceapi.your-space.com/status/json.


Status display page

Your space status is displayed on http://spaceapi.your-space.com or on http://spaceapi.your-space.com/status respectively.

The status can be displayed either by a button or by a monster.

Display page with a button Display page with a monster

To select one of both edit the following section in template.html

  // uncomment one of both in order to use either the
  // monster or a simple button to display the status

How to update sensor data?

To push data to the endpoint scripts the data structure to be sent to the server is a subset of the specification version 13.

E.g. to push the door status and two temperature sensor values your measurement unit (Raspberry Pi, Arduino, ...) must use the following structure.

    "state": {
        "open": true
    "sensors": {
        "temperature": [
            { "value": 31 },
            { "value": 23 }

Note: if you need to update an array of sensors this must be done in the same request since the order matters. This means that at the moment it's impossible to update the first temperature sensor by one microcontroller and the second by another. However different sensor arrays can be updated independently so in this case the state/open and sensors/temperature sensors could be updated in a separate request. An array is anything between the brackets [] so if you also had sensors/barometer you could update this in a separate request as well.

After urlencoding the json you make a GET request to the URL schema as shown below.


These parameters must be provided:

  • key, this value is a random string to protect the update script. This is not a strong protection and it's highly recommended to call the script via SSL. To change the key, simply edit config.json.
  • sensors, the sensor data to be updated server-side. You can push one single value or a whole bunch of sensor instances at once.

Example URL for updating the hackerspace/door status:


The following PHP code shows how to push data to your endpoint.

// change this to your actual endpoint URL without a trailing slash 
$endpoint_url = "http://my.hackerspace.com";

// if you changed the default api key in the endpoint script(s)
// you must change this key here too, otherwise no sensor data
// are updated server-side
$key = "86f7896f97asdf89u0a9s7d7fdasgsda88af";

$sensors = <<<JSON
    "state": {
        "open": true
    "sensors": {
        "temperature": [
            { "value": 31 },
            { "value": 23 }

// minify the json
$sensors = json_encode(json_decode($sensors));
$sensors = urlencode($sensors);

$ch = curl_init("$endpoint_url/sensor/set/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "sensors=$sensors&key=$key");
$data = curl_exec($ch);

If the URL, where you're trying to push, is a redirect, the snippet might not work under certain conditions. Read this to find out why.


curl --data-urlencode sensors='{"state":{"open":false}}' --data key=86f7896f97asdf89u0a9s7d7fdasgsda88af http://spaceapi.your-space.com/sensor/set

How to integrate the status with WordPress?

  • Login to your WordPress Backend
  • Click on Appearance > Widgets in the left sidebar
  • Drag the Text widget to your primary sidebar or wherever you want it
  • Now put this code line to your widget input field: <iframe src="http://spaceapi.my-hackerspace.com/">
Popular Json Projects
Popular Sensor Projects
Popular Data Formats Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.