Back-end server that handles apis for the alarm system. Main functions are:
- It saves the alarm state (armed or not armed).
- It receives reports from the motion sensor raspberry pi clients] when motion is detected.
- It will turn the siren if motion is detected while the alarm is armed.
- It will send emails, sms and make phone calls when motion is detected while alarm is armed.
- It will ask the camera api server to take photos when motion is detected while alarm is armed.
I suggest you first read about the different components of the home automation application.
This will help you understand better the general architecture and different functions of the system.
Click here and follow the installation instructions for the server micro-service, before moving to the next step.
AUTH_PUBLIC_KEY (required): content of auth server's publickey.
DATABASE_URL (required): url to postgres database. Default: postgres://postgres:@localhost/home_automation
KEEP_HISTORY_IN_DAYS (required): days to keep history in database. Default: 30
LOGIN_URL (required): url to the authentication server. Default: if NODE_ENV = production
=> none
, otherwise: http://localhost:3001
MOTION_DETECTED_SUBJECT (required): the subject of the email that will be sent when motion has been detected while the alarm is armed. Default: ALERT - Motion has been detected!
MOTION_DETECTED_TEXT (required): the subject of the email that will be sent when motion has been detected while the alarm is armed. Default:
Motion has been detected while the alarm system is armed.
Sensor name: <sensor_name>
NODE_ENV (required): set up the running environment. Default: production
. production
will enforce encryption using SSL and other security mechanisms.
NOTIFICATIONS_URL (required): url to notifications server. Default: if NODE_ENV = production
=> none
, otherwise: http://localhost:3004
PORT (required): server's port. default: 3002
POSTGRESPOOLMIN (required): postgres pool minimum size. Default: 2
POSTGRESPOOLMAX (required): postgres pool maximum size. Default: 10
POSTGRESPOOLLOG (required): postgres pool log. Values: true
/false
. Default: true
PRIVATE_KEY (required): Generated private key. Public key should be shared with the authentication server. See here.
SENSOR_MAY_BE_FAULTY_IN_DAYS (required): after the specified number of days, if the motion sensor has not reported of a movement, the sensor will be considered as "faulty". Default: 7
UI_URL (required): url to the UI server. Default: if NODE_ENV = production
=> none
, otherwise: http://localhost:3000