Difference between revisions of "SpaceAPI"

From Hackerspace ACKspace
Jump to: navigation, search
m (set to completed. Updates still might occur)
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Project
 
{{Project
|State=Active
+
|Featured=No
|Members=Vicarious, CoolePascal
+
|State=Completed
 +
|Members=Vicarious, Coolepascal, Prodigity, Da Syntax, xopr, stuiterveer
 
|Description=HackerSpace Status API
 
|Description=HackerSpace Status API
 +
|GitHub=spaceAPI
 
}}
 
}}
See [https://hackerspaces.nl/spaceapi/ hackerspaces.nl SpaceAPI website] for details.
+
== synopsis ==
 +
Expose hackerspace information via a <abbr title="JavaScript Object Notation">JSON</abbr> structure.
 +
See [https://spaceapi.net/ spaceapi.net] for details.
  
== Done so far: ==
+
== current version ==
 +
The current backend has been made modular for easy maintenance and feature expansion.
 +
The first implemented expansion is temperature sensors.
  
* Prepared the JSON object:
+
Most of the latest implementation has been done by [[user:Da_Syntax|Da Syntax]] and [[User:Xopr|xopr]] (ask them for details).
  
If ACKspace is open:
+
Currently, both the new and old system are running in parallel, but some things need to be done before deprecating the old system.
<pre>
+
* Update the ackspace.nl/spacestate.php 'widget' which was used on [http://hackerspaces.nl/ hackerspaces.nl] (determine whether this can be removed completely)
{
+
* <s>ackspace.nl/status.php</s> now gives a 301 - moved permanently, which is needed because the open space directory of [http://spaceapi.net/directory.json spaceapi.net (JSON)] and its [[GitHub::https://github.com/SpaceApi/OpenSpaceDirectory|GitHub repo]] is outdated; it is superseded by '''[https://spaceapi.fixme.ch/directory.json fixme.ch (JSON)]''' with the latest revision on '''[[GitHub::https://github.com/fixme-lausanne/OpenSpaceDirectory|fixme-lausanne's GitHub repo]]'''
  "api":"0.11",
 
  "space":"ACKspace",
 
  "logo":"https:\/\/ackspace.nl\/ACKspace.150px.png",
 
  "icon":{
 
    "open":"https:\/\/ackspace.nl\/icon\/open.png",
 
    "closed":"https:\/\/ackspace.nl\/icon\/closed.png"
 
  },
 
  "url":"https:\/\/ackspace.nl\/",
 
  "address":"Kloosterweg 1, 6411 VM Heerlen, The Netherlands",
 
  "contact":[
 
    {"phone":"+31457112345"},
 
    {"sip":"sip:31457112345@sip1.budgetphone.nl"},
 
    {"irc":"irc://freenode/#ACKspace"},
 
    {"twitter":"@ACKspace"},
 
    {"email":"contact@ackspace.nl"},
 
    {"ml":"info@lists.ackspace.nl"},
 
  "open":true,
 
  "status":"open for public",
 
  "lastchange":1320586506,
 
}
 
</pre>
 
  
 +
Several systems are tied to the backend:
  
If ACKspace is closed:
+
{| class="wikitable"
<pre>
+
! inputs
{
+
! category
  "api":"0.11",
+
!
  "space":"ACKspace",
+
! outputs
  "logo":"https:\/\/ackspace.nl\/ACKspace.150px.png",
+
! category
  "icon":{
+
|-
    "open":"https:\/\/ackspace.nl\/icon\/open.png",
+
| [[Space state]] (switch)
    "closed":"https:\/\/ackspace.nl\/icon\/closed.png"
+
| hardware
  },
+
|
  "url":"https:\/\/ackspace.nl\/",
+
| [[Telephone_system:Space_state|Space state (telephone system)]]
  "address":"Kloosterweg 1, 6411 VM Heerlen, The Netherlands",
+
| software
  "contact":[
+
|-
    {"phone":"+31457112345"},
+
| [[ESP8266-SpaceState]]
    {"sip":"sip:31457112345@sip1.budgetphone.nl"},
+
| hardware, firmware
    {"irc":"irc://freenode/#ACKspace"},
+
|
    {"twitter":"@ACKspace"},
+
| [[Spacestate indicator]] <abbr title="incomplete">/!\</abbr>
    {"email":"contact@ackspace.nl"},
+
| hardware, firmware
    {"ml":"info@lists.ackspace.nl"},
+
|-
  "open":false,
+
| [[Spacestate sensors]] <abbr title="incomplete">/!\</abbr>
  "status":"closed",
+
| hardware, firmware
  "lastchange":1320586507,
+
|
}
+
| [[Mobile Spacestate Indicator]]
</pre>
+
| hardware, firmware, software
 +
|-
 +
|
 +
|
 +
|
 +
| [[IRC ACKspace-statusbot]]
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [[SpaceAPIBot]] ([https://telegram.org Telegram])
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [https://github.com/ACKspace/Pebble-ACKspace-app Pebble watch app]
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [[Widget:SpaceAPI]]
 +
| software
 +
|}
  
* Uploaded it to [https://ackspace.nl/status/index.php] but the URL can be changed if necessary..
+
Affiliated github repositories:
 +
* [[GitHub::https://github.com/ACKspace/spaceAPI|spaceAPI]]: backend
 +
* [[GitHub::https://github.com/ACKspace/SpaceAPIBot|SpaceAPIBot]]: Telegram bot output
 +
* [[GitHub::https://github.com/ACKspace/esp8266-SpaceAPI|esp8266-SpaceAPI]]: modular implementation on [[ESP8266]] (input/output)
 +
 
 +
Deprecated implementations:
 +
* [[ESP8266-DS18S20]]: old sensor implementation (pull mechanism)
 +
 
 +
=== todo ===
 +
* upload database model
 +
* update the [[ESP8266-DS18S20|Dallas temperature probe]] and [[ESP8266-SpaceState|space state]] firmware ([https://github.com/ACKspace/esp8266-SpaceAPI esp8266-SpaceAPI Github repo])
 +
 
 +
=== done ===
 +
* created database for space state (log) and sensor values
 +
* new php code online (currently running parallel with the old version)
 +
* created new [[ESP8266-SpaceState|space state]] hardware interface using the [[ESP8266]] which connects to the same old [[space state|switch]]
 +
* <s>First draft after recovery [[Media:esp8266-SpaceAPI-full.tar|esp8266-SpaceAPI-full.tar]]</s> Note that the used JSON parser library will cause heap corruption.
 +
* front page widget is now a real widget
 +
* php backend source online
 +
 
 +
== old version ==
 +
* Updated JSON object to become SpaceAPI 0.13 compliant (see status.php)
 +
**Content type and Cache-Control headers are now sent
 +
**Now uses location object
 +
**Now uses state object
 +
**Space state now has a third state; null. (In case of uncertain state)
 +
* Uploaded it to <s>ackspace.nl/status.php</s> but the URL can be changed if necessary..
 
* From the SpaceAPI website: "In order to be able to retrieve the object from within a javascript sandbox, the server of the JSON object should set the ‘Access-Control-Allow-Origin’ header with a value of ‘*’ ".
 
* From the SpaceAPI website: "In order to be able to retrieve the object from within a javascript sandbox, the server of the JSON object should set the ‘Access-Control-Allow-Origin’ header with a value of ‘*’ ".
 +
* Added the JSON object to the existing [[Space state]] PHP script. Thanks [[User:Coolepascal|CoolePascal]] for the help with the PHP stuff!
  
 
+
[[Category:SpaceAPI]]
== To do list: ==
 
* The open/closed icons still have to be created and uploaded.
 
* Add the JSON object to the existing [[Space state]] perl script or create a new script.
 
* From the SpaceAPI website: "Additionally, it might be beneficial to add a ‘Cache-Control’ header with a value of ‘no-cache’, to prevent browser caches from retaining old data."
 

Revision as of 10:50, 10 April 2018

Project: SpaceAPI
Featured: No
State Completed
Members Vicarious, Coolepascal, Prodigity, Da Syntax, xopr, stuiterveer
GitHub spaceAPI
Description HackerSpace Status API
Picture
No project picture! Fill in form Picture or Upload a jpeg here

synopsis

Expose hackerspace information via a JSON structure. See spaceapi.net for details.

current version

The current backend has been made modular for easy maintenance and feature expansion. The first implemented expansion is temperature sensors.

Most of the latest implementation has been done by Da Syntax and xopr (ask them for details).

Currently, both the new and old system are running in parallel, but some things need to be done before deprecating the old system.

Several systems are tied to the backend:

inputs category outputs category
Space state (switch) hardware Space state (telephone system) software
ESP8266-SpaceState hardware, firmware Spacestate indicator /!\ hardware, firmware
Spacestate sensors /!\ hardware, firmware Mobile Spacestate Indicator hardware, firmware, software
IRC ACKspace-statusbot software
SpaceAPIBot (Telegram) software
Pebble watch app software
Widget:SpaceAPI software

Affiliated github repositories:

Deprecated implementations:

todo

done

  • created database for space state (log) and sensor values
  • new php code online (currently running parallel with the old version)
  • created new space state hardware interface using the ESP8266 which connects to the same old switch
  • First draft after recovery esp8266-SpaceAPI-full.tar Note that the used JSON parser library will cause heap corruption.
  • front page widget is now a real widget
  • php backend source online

old version

  • Updated JSON object to become SpaceAPI 0.13 compliant (see status.php)
    • Content type and Cache-Control headers are now sent
    • Now uses location object
    • Now uses state object
    • Space state now has a third state; null. (In case of uncertain state)
  • Uploaded it to ackspace.nl/status.php but the URL can be changed if necessary..
  • From the SpaceAPI website: "In order to be able to retrieve the object from within a javascript sandbox, the server of the JSON object should set the ‘Access-Control-Allow-Origin’ header with a value of ‘*’ ".
  • Added the JSON object to the existing Space state PHP script. Thanks CoolePascal for the help with the PHP stuff!