Sensor package provides drivers for various sensors.

Temperature

Summary

Temperature interface provides functions to read temperature.

Supported devices

Methods list

getKelvin()

Returns the temperature in kelvin.

REST API : GET /devices/name/sensor/temperature/k

getCelsius()

Returns the temperature in celsius.

REST API : GET /devices/name/sensor/temperature/c

getFahrenheit()

Returns the temperature in fahrenheit.

REST API : GET /devices/name/sensor/temperature/f

Python example

from webiopi.devices.analog import TMP102
tmp = TMP102(...)           # setup a TMP102 I2C Temperature sensor
# or
from webiopi import deviceInstance
tmp = deviceInstance("tmp") # retrieve device named "tmp" in configuration file

tmp.getKelvin()
tmp.getCelsius()
tmp.getFahrenheit()

REST example

HTTP GET /devices/tmp/sensor/temperature/k
HTTP GET /devices/tmp/sensor/temperature/c
HTTP GET /devices/tmp/sensor/temperature/f

Pressure

Summary

Pressure interface provides functions to read atmospheric pressure.

Supported devices

Methods list

getPascal()

Returns the pressure in pascal.

REST API : GET /devices/name/sensor/pressure/pa

getHectoPascal()

Returns the pressure in hecto pascal.

REST API : GET /devices/name/sensor/pressure/hpa

getPascalAtSea()

Returns the pressure at sea level in pascal.

REST API : GET /devices/name/sensor/pressure/sea/pa

getHectoPascalAtSea()

Returns the pressure at sea level in hecto pascal.

REST API : GET /devices/name/sensor/pressure/sea/hpa

Python example

from webiopi.devices.analog import BMP085
bmp = BMP085(...)           # setup a BMP085 I2C Pressure sensor
# or
from webiopi import deviceInstance
bmp = deviceInstance("bmp") # retrieve device named "bmp" in configuration file

bmp.getHectoPascal()
bmp.getHectoPascalAtSea()

REST example

HTTP GET /devices/bmp/sensor/pressure/hpa
HTTP GET /devices/bmp/sensor/pressure/sea/hpa

Luminosity

Summary

Luminosity interface provides functions to measure light.

Supported devices

Methods list

getLux()

Returns the luminosity in lux.

REST API : GET /devices/name/sensor/luminosity/lx

Python example

from webiopi.devices.analog import TSL2561
tsl = TSL2561(...)          # setup a TSL2561 I2C Luminosity sensor
# or
from webiopi import deviceInstance
tsl = deviceInstance("tsl") # retrieve device named "tsl" in configuration file

tsl.getLux()

REST example

HTTP GET /devices/tmp/sensor/luminosity/lx

Distance

Summary

Distance interface provides functions to measure distances.

Supported devices

Methods list

getMillimeter()

Returns the distance in millimeter.

REST API : GET /devices/name/sensor/distance/mm

getCentimeter()

Returns the distance in millimeter.

REST API : GET /devices/name/sensor/distance/cm

getInch()

Returns the distance in millimeter.

REST API : GET /devices/name/sensor/distance/in

Python example

from webiopi.devices.analog import TSL2561
vcn = VCNL4000(...)         # setup a VCNL4000 I2C Luminosity sensor
# or
from webiopi import deviceInstance
vcn = deviceInstance("vcn") # retrieve device named "vcn" in configuration file

vcn.getMillimeter()

REST example

HTTP GET /devices/tmp/sensor/distance/mm