Skip to content

Remote data

TheYOSH edited this page Nov 22, 2017 · 8 revisions

Document is in progress....

With TerrariumPI it is possible to retrieve remote sensor data. This document describes the url format that is needed in order to get the remote data. For now only JSON data is supported.

Warning: This data will be pulled every 30 seconds! So make sure that there are no API limits

JSON Data Example

Remote source url: https://terrarium.theyosh.nl/api/sensors/f745feb874df5673e157ef8c69e586b4

json output: {"sensors": [{"alarm_min": 20.0, "address": "26C04A8F01000042", "id": "f745feb874df5673e157ef8c69e586b4", "limit_max": 45.0, "alarm_max": 30.0, "name": "Top", "alarm": false, "hardwaretype": "owfs", "current": 28.8125, "limit_min": 10.0, "type": "temperature"}]}

json traversal path: sensors/0/current

Construct full url by combining the remote source url and the json traversal path joining by a dash '#'. Full remote source url: https://terrarium.theyosh.nl/api/sensors/f745feb874df5673e157ef8c69e586b4#sensors/0/current

The 'json traversal path' is needed to get the right value from the JSON data. In the example above the JSON data starts with 'sensors' which is an array. Therefore the second value is '0' so we get the first item of the array. And the latest is 'current' because that holds the current value that we want. In this case 28.8125

Clone this wiki locally