Skip to content
TheYOSH edited this page Jul 26, 2018 · 2 revisions

The following API calls are available for integration with other 3rd party software. All output is in JSON.

*All API calls with an asterisk needs authentication

GET /api/sensors

This will give a list of all sensors and there properties and values

GET /api/sensors/average

This will give a list of average values per sensor type

GET /api/sensors/[sensorid]

This will give the information of a single sensor

GET /api/sensors/[sensortype]

This will give a list of sensors filtered by the sensor type. Valid sensortype values are:

  • temperature
  • humidity
  • distance
  • moisture
  • conductivity
  • ph
  • light
  • fertility

GET /api/sensors/[sensortype]/average

This will give the average of the sensor list filtered by sensor type

GET /api/switches

This will give a list of all power switches

GET /api/switches/[switchid]

This will give the information of a single power switch

POST /api/switch/toggle/[switchid] *

This will change the state of the power switch from on to off or vise versa

POST /api/switch/state/[switchid]/[value] *

This will change the state of a power switch. Valid value values are:

  • 0 is off, and 1 is on
  • range from 0 to 100 if it is a dimmer

GET /api/doors

This will give a list of all door sensors

GET /api/doors/status

This will give a single door status based on all the available door sensors

GET /api/doors/[doorid]

This will give the information of a single door sensor

GET /api/webcams

This will give a list of all webcams

GET /api/webcams/[webcamid]

This will give the information of a single webcam

GET /api/webcams/[webcamid]/archive

This will give the information of a single webcam with image archive list

GET /api/audio

This will give a list of all the audio playlists

GET /api/audio/files

This will give a list of all the available audio files with meta information

GET /api/audio/playing

This will give what is currently playing

GET /api/audio/hardware

This will give a list of all audio hardware devices. Internal as USB is supported

GET /api/weather

This will give the weather information like sun rise and sun set, as the weather forecast and current values

GET /api/profile

This will give all the profile information

GET /api/environment

This will give the complete environment data of all enabled parts

GET /api/environment/[environmentpart]

This will give the output of a single part of the environment system Valid environmentpart values are:

  • light
  • temperature
  • humidity
  • moisture
  • ph
  • conductivity
  • watertank

GET /api/uptime

This will give the uptime information

GET /api/power_usage

This will give the current power usage

GET /api/water_usage

This will give the current water flow

GET /api/system

This will give the current system load and disk usage

GET /api/config

This will give all the configuration values of all parts of TerrariumPI

GET /api/config/[configpart]

GET /api/history/[datatype]

This will give the history of a specified data part of TerrariumPI. By default it will return the last 24 hours Valid datatype values are:

  • sensors
  • switches
  • doors
  • weather
  • system

GET /api/history/[datatype]/[period]

This will give the history of a specified data part of TerrariumPI for the last period of time This period value can be used in all history API call as last part of the url Valid period values are:

  • day
  • week
  • month
  • year

GET /api/history/sensors/[sensortype]

This will give the history of a all the sensors filtered by sensor type. By default it will return the last 24 hours

GET /api/history/sensors/[sensorid]

This will give the history of a single senor. By default it will return the last 24 hours

GET /api/history/sensors/average

This will give the history of the average values per sensor type. By default it will return the last 24 hours

GET /api/history/switches/[switchid]

This will give the history of a single power switch. By default it will return the last 24 hours

GET /api/history/doors/[doorid]

This will give the history of a single door. By default it will return the last 24 hours

GET /api/history/weather

This will give the history of the weather temperatures

GET /api/history/system

This will give the history of the system. This includes cpu load, memory and disk usage

GET /api/history/system/[systempart]

This will give the history of part of the system. Valid systempart values are:

  • load
  • cores
  • uptime
  • temperature
  • memory
  • disk

GET /api/export/ ...