Difference between revisions of "SpaceAPI"

From Hackerspace ACKspace
Jump to: navigation, search
m (made old json block collapsible)
m (home assistant link)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Project
 
{{Project
|State=Active
+
|Featured=No
|Members=Vicarious, CoolePascal, Prodigity, Da Syntax, xopr
+
|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.io/docs/ spaceapi.io] for documentation (or its [http://spaceapi.net/ old site (unsecure)]).
  
 
== current version ==
 
== current version ==
[[user:Da_Syntax|Da Syntax]] and [[User:Xopr|xopr]] are working on a new implementation of the API.  This enables us to add sensors and other parts of the [https://hackerspaces.nl/spaceapi/ official API] as well.
+
The current backend has been made modular for easy maintenance and feature expansion.
 +
Several expansions are already in place:
 +
* temperature
 +
* [https://ackspace.nl/spaceAPI/geo.php geo location] for [[Hackers on a Bike]]
 +
* [https://ackspace.nl/spaceAPI/statechanges.html heatmap] (also [https://mapall.space/heatmap//show.php?id=ACKspace externally here])
 +
* [https://ackspace.nl/spaceAPI/conference.html teleconference status]
 +
* [https://ackspace.nl/spaceAPI/services.html services status]
 +
* [https://ackspace.nl/spaceAPI/audit.html stock supply]
 +
 
 +
Most of the first implementation has been done by [[user:Da_Syntax|Da Syntax]] and [[User:Xopr|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.
 
Currently, both the new and old system are running in parallel, but some things need to be done before deprecating the old system.
* Update the [http://ackspace.nl/spacestate.php status page] code which is used on [http://hackerspaces.nl/ hackerspaces.nl]
 
* Update the places where [https://ackspace.nl/status.php ackspace.nl/status.php] is used
 
  
=== the software ===
+
The active maintained SpaceAPI project is at [https://spaceapi.io spaceapi.io].
TODO: add the PHP code and SQL tables.
+
* Directory is at https://directory.spaceapi.io/
 +
* A feature full API is at https://api.spaceapi.io/ (described at https://api.spaceapi.io/openapi.json )
 +
* The latest directory is at [https://raw.githubusercontent.com/SpaceApi/directory/master/directory.json github] but may contain automated problems at times
 +
* There is a cached directory at https://api.spaceapi.community/
 +
* There is a cached API at https://api.spaceapi.community/cache
 +
* The old maintained directory is at https://spaceapi.fixme.ch/directory.json with the [[GitHub::https://github.com/fixme-lausanne/OpenSpaceDirectory|fixme-lausanne's GitHub repo here]]
 +
* [http://hackerspaces.nl/ hackerspaces.nl] uses the SpaceAPI
 +
 
 +
Several systems are tied to the backend:
  
Also see [[IRC ACKspace-statusbot|ACKbot]]
+
{| class="wikitable"
 +
! inputs
 +
! category
 +
!
 +
! outputs
 +
! category
 +
|-
 +
| [[MQTT]] (bridge)
 +
| software
 +
|
 +
| [[Telephone_system:Space_state|Space state (telephone system)]]
 +
| software
 +
|-
 +
| [[Spacestate sensors]] <abbr title="incomplete and replaced by MQTT">/!\</abbr>
 +
| hardware, firmware
 +
|
 +
| [[User:Vicarious|Vicarious']] [[Mobile Spacestate Indicator]]
 +
| hardware, firmware, software
 +
|-
 +
| [[Space state]] (switch)<abbr title="replaced by MQTT">/!\</abbr>
 +
| hardware
 +
|
 +
| [[IRC ACKspace-statusbot]]
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [[User:Stuiterveer|Stuiterveer's]] [[SpaceAPIBot]] ([https://telegram.org Telegram])
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [https://github.com/ACKspace/Pebble-ACKspace-app Pebble watch app]
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [[Widget:SpaceAPI]]
 +
| software
 +
|-
 +
|
 +
|
 +
|
 +
| [[User:Danny Witberg|Danny W's]] [[Spacestate indicator]] <abbr title="incomplete">/!\</abbr>
 +
| hardware, firmware
 +
|-
 +
|
 +
|
 +
|
 +
| [[User:Coolepascal|CoolePascal's]] [[SpaceStateIndicator]]
 +
| hardware, firmware
 +
|-
 +
|
 +
|
 +
|
 +
| [[Home Assistant]]
 +
| software integration
 +
|}
 +
For a possibly more complete list, look at the [[:Category:SpaceAPI|SpaceAPI category]]
  
=== the hardware ===
+
Affiliated github repositories:
Currently, the hardware of the two units controlling the spaceAPI are based on the [[ESP8266-SpaceState]] and [[ESP8266-DS18S20]].
+
* [[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)
  
=== the firmware ===
+
Deprecated implementations:
The current two running firmwares are based on this [https://github.com/ACKspace/esp8266-SpaceAPI esp8266-SpaceAPI Github repo], which needs cleanup and features added. The new [[Mobile Spacestate Indicator]] is also based on this code.
+
* [[ESP8266-DS18S20]]: old sensor implementation (pull mechanism)
  
Its first incarnation can be found on the [[ESP8266-SpaceState#code|ESP8266-SpaceState]] page.
+
=== todo ===
 +
* upload database model
  
 
=== done ===
 
=== done ===
Line 30: Line 113:
 
* new php code online (currently running parallel with the old version)
 
* 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]]
 
* 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.
+
* <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
=== todo ===
+
* php backend source online
* implement the temperature backend (PHP/MySQL)
 
* update the [[ESP8266-DS18S20|Dallas temperature probe]] and [[ESP8266-SpaceState|space state]] firmware
 
* update this wiki page with the sources
 
* change the front page iframe into a real [[Widget:SpaceAPI|widget]]
 
  
 
== old version ==
 
== old version ==
 
 
* Updated JSON object to become SpaceAPI 0.13 compliant (see status.php)
 
* Updated JSON object to become SpaceAPI 0.13 compliant (see status.php)
 
**Content type and Cache-Control headers are now sent
 
**Content type and Cache-Control headers are now sent
Line 45: Line 123:
 
**Now uses state object
 
**Now uses state object
 
**Space state now has a third state; null. (In case of uncertain state)
 
**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..
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-spaceAPI">
 
==== spaceAPI json ====
 
<div class="mw-customtoggle-spaceAPI mw-code">Click here to view the source code</div>
 
<pre class="mw-collapsible-content">
 
{
 
  "api":"0.13",
 
  "space":"ACKspace",
 
  "logo":"https://ackspace.nl/ACKspace.150px.png",
 
  "url":"https://ackspace.nl/",
 
  "location":{
 
    "address":"Kloosterweg 1, 6412 CN Heerlen, The Netherlands",
 
    "lat":50.892665,
 
    "lon":5.971104
 
  },
 
  "issue_report_channels":[
 
    "email"
 
  ],
 
  "feeds":{
 
    "calendar":{
 
      "type": "text/calendar",
 
      "url": "http://www.google.com/calendar/ical/f3j6egtm35u2v027rog3sob7gk%40group.calendar.google.com/public/basic.ics"
 
    }
 
  },
 
  "contact":{
 
    "email":"contact@ackspace.nl",
 
    "irc":"irc://freenode/#ACKspace",
 
    "keymaster":[
 
      "31457112345, extension 1333"
 
    ],
 
    "ml":"info@lists.ackspace.nl",
 
    "phone":"31457112345",
 
    "sip":"31457112345@sip1.budgetphone.nl",
 
    "twitter":"@ACKspace"
 
  },"state":{
 
"open":true,
 
"message":"open for public",
 
"lastchange":1415742805,
 
"icon":{
 
"open":"https://ackspace.nl/icon/open.png",
 
"closed":"https://ackspace.nl/icon/closed.png"
 
}
 
}
 
}
 
</pre>
 
</div>
 
 
 
* Uploaded it to [https://ackspace.nl/status.php https://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 ‘*’ ".
 
* 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!
 
* Added the JSON object to the existing [[Space state]] PHP script. Thanks [[User:Coolepascal|CoolePascal]] for the help with the PHP stuff!
  
 
[[Category:SpaceAPI]]
 
[[Category:SpaceAPI]]

Latest revision as of 17:02, 11 November 2024

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.io for documentation (or its old site (unsecure)).

current version

The current backend has been made modular for easy maintenance and feature expansion. Several expansions are already in place:

Most of the first 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.

The active maintained SpaceAPI project is at spaceapi.io.

Several systems are tied to the backend:

inputs category outputs category
MQTT (bridge) software Space state (telephone system) software
Spacestate sensors /!\ hardware, firmware Vicarious' Mobile Spacestate Indicator hardware, firmware, software
Space state (switch)/!\ hardware IRC ACKspace-statusbot software
Stuiterveer's SpaceAPIBot (Telegram) software
Pebble watch app software
Widget:SpaceAPI software
Danny W's Spacestate indicator /!\ hardware, firmware
CoolePascal's SpaceStateIndicator hardware, firmware
Home Assistant software integration

For a possibly more complete list, look at the SpaceAPI category

Affiliated github repositories:

Deprecated implementations:

todo

  • upload database model

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!