Skip to content

Sensors

Adam edited this page Aug 6, 2015 · 7 revisions

Alarm

Alarm sensor reads information exposed via programmable output pins of alarm control panel. In my case there are two output pins, one of them indicates whether alarm is armed, second whether some intrusion has been detected.

Requirements

There are no software prerequisites required to run plugin.

Configuration

To properly run plugin, you need to properly set pin numbers in constants in alarm.py:

ALARM_ARMED_PIN = XX
ALARM_ALERT_PIN = XX

Output state

{
   "armed": true,
   "alert": false
}

DHT

DHT sensor uses information from DHT-11 humidity sensor, which comes also with thermometer. Currently it uses solution described here.

Requirements

For sensor to run properly it's required to follow all steps in link above. After cloning GitHub sources there, you should copy script: ./tools/dht_reader.py to examples directory. Out of the box, I assume that you have cloned Adafruit_Python_DHT sources to /usr/src/, if that assumption isn't valid, then please update following variable in dht.py:

HUMIDITY_READ_CMD_FORMAT = 'python /usr/src/Adafruit_Python_DHT/examples/dht_reader.py {sensor} {pin}'

Configuration

There are two variables to adjust in hygrometer.py to run properly:

  1. SENSOR - should contain model of hygrometer that you've wired up: 11 for DHT-11, 22 for DHT-22, 2302 for AM2302.
  2. PIN - should point at pin number, to which sensor is connected.

Output state

{
   "humidity": {
      "value": 34,
      "unit": "Percent",
      "unit_symbol": "%"
   },
   "temperature": {
      "value": 23.512,
      "unit": "Celsius",
      "unit_symbol": "C"
   }
}

Barometer

Barometer sensor reads information from BMP180 device.

Requirements

For sensor to run properly you need to clone this Adafruit repository to /usr/src/ directory. If you choose another directory, please update path in file barometer.py:

PRESSURE_READ_CMD = '/usr/src/Adafruit-Raspberry-Pi-Python-Code/Adafruit_BMP085/pressure_reader.py'

Copy file from ./tools/pressure_reader.py to /usr/src/Adafruit-Raspberry-Pi-Python-Code/Adafruit_BMP085/, and your ready to go.

Configuration

No further configuration is required.

Output state

Apart from atmospheric pressure, sensor outputs temperature read from barometer. As barometer is stored inside my box, temperature might be used to prevent box from overheating.

{
   "value": 1018,
   "unit": "hectopascal",
   "unit_symbol": "hPa",
   "internal_temperature": 26.5
}

Weather forecast

Weather forecast sensor reads information provided by http://www.worldweatheronline.com/ service.

Requirements

To run sensor correctly, internet connection is required.

Configuration

You should copy file from ./config/weather.ini to /etc/command_center/weather.ini and edit it according to following hints:

  1. api_url - address of worldweatheronline API service. On the moment of writing it's: http://api.worldweatheronline.com/free/v2/weather.ashx
  2. location_query - location for which weather will be checked. In form "city,country", e.g. Cracow,Poland
  3. api_key - your API key generated via worldweatheronline portal

Output state

Output state consists of two parts:

  1. Containing information about current weather
  2. Containing forecast for next 8 readings, entries interval is 3 hours, so it makes 24h ahead.

Readings units are as follows. All values are integers.

  • cloud_cover - percent
  • humidity - percent
  • temperature - Celsius degrees
  • felt_temperature - Celsius degrees
  • visibility - percent
  • chance_of_rain - percent
{
   "current": {
      "cloud_cover": 23,
      "humidity": 33,
      "temperature": 20,
      "felt_temperature": 24,
      "visibility": 76
   },
   "forecast": [
      {
         "chance_of_rain": 2,
         "temperature": 28,
         "felt_temperature": 33,
         "humidity": 32,
         "cloud_cover": 5,
         "visibility": 80
      },
      {
         "chance_of_rain": 2,
         "temperature": 28,
         "felt_temperature": 33,
         "humidity": 32,
         "cloud_cover": 5,
         "visibility": 80
      },
      ...
   ]
}

Clone this wiki locally