Skip to content

Database schema

Matt Bartos edited this page May 19, 2017 · 1 revision

Database schema

Databases

Database Name Description
HOME Home database for sensor nodes
_META Metadata for nodes (including parameters)
_EXTERN Database for temporary external data
_FIRMWARE Versioned firmware file content
_TEST Test database

Users

User Type Username Permissions Description
Human admin [ALL:ALL] Do not use unless needed
test [_TEST:ALL] For testing read/writes
generic-reader [HOME:R] Generic read-only permissions
Nodes test-node [_TEST:RW] User for secured test node
generic-node [ALL:RW] User for secured generic node
Daemons grafana [HOME:R] Forwards data into secured db
meta-reader [_META:R, _FIRMWARE:R] Used for identity updater, bootloader, etc.

Naming conventions

General considerations

  • variables/tags: lowercase ascii letters and digits with underscores
  • users: lowercase ascii letters and digits with hyphen
  • databases: uppercase ascii letters and digits with underscores

Variables

Sensor variables

These variables are associated with each sensor.

Variable Source Slug Units Description
Battery voltage Board v_bat V Battery voltage in volts
Ultrasonic depth Maxbotix Depth Sensor maxbotix_depth mm Depth in millimeters
Optical rain depth Hydreon Optical Rain Sensor hydreon_prcp in_10 Rain accumulation in tenths of an inch
Soil conductivity Decagon Soil Moisture Sensor decagon_soil_conduct dS_m Soil conductivity in deciSiemens/meter
Soil dielectric constant Decagon Soil Moisture Sensor decagon_soil_dielec Soil dielectric constant
Soil temperature Decagon Soil Moisture Sensor decagon_soil_temp C Soil temperature in Celsius
Soil error Decagon Soil Moisture Sensor decagon_soil_error N/A Soil moisture sensor error code
Valve position Valve valve_trigger Valve state and/or position

Meta variables

These variables are associated with each node.

Purpose Variable Slug Type Description
Identification Node ID node_id str Unique node ID assigned to each node
Cellular MEID meid str MEID of cellular module
Location Site Name site_name str Site name indicating location of node
Latitude lat float Latitude of node location
Longitude lon float Longitude of node location
Elevation elev float Elevation of node in meters
Firmware App Name app_name str (Human-readable) name of app
Custom App ID custom_app_id hex Built-in ID number of bootloadable file
App Version app_version hex Built-in version of bootloadable file
Parameter Sleep timer sleeptimer uint Number of wakeups before routine (sampling frequency)
Write endpoint node_endpoint str Endpoint to write data to
Write port node_port uint Port to write data to
Write database node_db str Database to write data to
Write user node_user str Username for node’s home database
Write password node_pass str Password for node’s home database
Battery flag vbat_flag bool 1 to enable v_bat reading, 0 to disable
Ultrasonic flag ultrasonic_flag bool 1 to enable ultrasonic sensor, 0 to disable
Optical rain flag optical_rain_flag bool 1 to enable optical rain sensor, 0 to disable
Decagon flag decagon_flag bool 1 to enable decagon sensor, 0 to disable
Ultrasonic mode ultrasonic_mode bool 1 to take average of readings, 0 for first valid reading
Decagon mode decagon_mode bool 1 to take average of readings, 0 for first valid reading

Notes

  • For debugging, include user as a tag whenever performing write operation.
  • When writing web apps, always sanitize query inputs to prevent SQL injection.
  • We recommend using a service to change node passwords regularly.