Skip to content

Configuration

danecreekphotography edited this page Jun 25, 2020 · 19 revisions

General settings for the system as well as configuration options for outbound services are managed in the settings.json file. An annotated sample file to start from is available in the sampleConfiguration directory for the project.

System configuration

The following settings are available for general system configuration:

Property Description Example
awaitWriteFinish Optional. Waits for writes to finish before analyzing images. This is useful if the images live on a network drive that's mounted to Docker, but comes with a performance penalty. Disabled by default. true
deepstackUri Required. The address of the Deepstack AI server. http://deepstack-ai:5000/
enableAnnotations Turns on writing annotated images to local storage for use in outbound messages. Automatically enables the internal web server as well. Optional. Default false. true
enableWebServer Turns on the internal web server, bound to port 4242 by default. This is necessary if you want to use the REST API to activate triggers. true
mqtt Configuration for sending MQTT messages. Optional. See below.
port The port number for the internal web server. Only used when enableAnnotations is true. optional. Default 4242. 5004
purgeAge The length of time, in minutes, an annotated image in temporary storage must go without being accessed before being purged. Optional. Default 60. 120
purgeInterval Controls how long the system waits between purges of temporary annotated image storage, in minutes. Optional. Default 30. 10
verbose Controls the level of output logging. If false or omitted then only startup messages, warnings, errors, and successful AI detection are logged. Optional. Default false. true
pushbullet Configuration for sending Pushbullet messages. Optional. See below.
pushover Configuration for sending Pushover messages. Optional. See below.
telegram Configuration for sending Telegram bot messages. Optional. See below.

Enabling & configuring MQTT

MQTT is enabled by adding an mqtt property to settings.json. The following options are supported:

Property Description Example
enabled If true then MQTT is enabled. Optional. Default true. false
password The password to log into the server with. Optional. "pass"
rejectUnauthorized Controls whether connections to mqtts:// servers should allow self-signed certificates. Set to false if your MQTT certificates are self-signed and are getting connection errors. Optional. Default true. false
retain If true all MQTT messages are sent with the retain flag on. Optional. Default false. true
username The username to log into the server with. Optional. "user"
uri Required. The address of the MQTT server. "mqtt://192.168.1.100:1883"

The only authentication method currently supported is basic.

When MQTT is enabled status messages are automatically sent that report the health of the server. These messages are useful in conjunction with MQTT binary sensors in Home Assistant to monitor whether the server is running and send notifications to people if it goes down for some reason.

Example configuration for basic MQTT integration

"mqtt" : {
   "uri": "mqtt://192.168.1.100:1883",
   "username": "user",
   "password": "pass",
   "retain: true
}

Online status message after successful startup

{
   "state": "online"
}

Online status message after each image is processed

{
   "state": "online",
   "triggeredCount": 5
   "analyzedFilesCount": 60
}

triggeredCount is the total number of times a trigger met all the defined requirements and fired its registered handlers. analyzedFilesCount is the total number of times a trigger evaluated an image. Note: if multiple triggers are registered for the same watchPattern then each trigger will increment the analyzed file count.

Offline status message after failed startup

{
   "state": "offline",
   "details": "error details included here"
}

Offline status in LWT message

{
   "state": "offline"
}

Enabling & configuring Telegram

Telegram is enabled by adding a telegram property to settings.json. The following options are supported:

Property Description Example
botToken Required. The bot token for your Telegram bot server. "123987123:adfk2893r7akdskanfsdalskf"
enabled If true then Telegram is enabled. Optional. Default true. false

Obtaining the botToken and chatIds for the trigger configuration is not hard but does take a few steps. Here's what you need to do:

  1. Contact BotFather on Telegram
  2. Send the /newbot command. Follow the instructions and you'll get back a token that looks something like the one in the example above.
  3. Connect to the bot in your Telegram personal account and send it a message
  4. Go to https://api.telegram.org/bot123987123:adfk2893r7akdskanfsdalskf/getUpdates, after replacing the token in the URL with the one you obtained in step 2.
  5. In the response look for the id field to obtain the chatId. In the below sample response the chatId is 12345.
{"ok":true,"result":[{"update_id":297596982,
"message":{"message_id":2,"from":{"id":12345,"is_bot":false,"first_name":"Neil","last_name":"Enns","language_code":"en"},"chat":{"id":12345,"first_name":"Neil","last_name":"Enns","type":"private"},"date":1590551469,"text":"hi"}}]}

Example configuration for Telegram integration

"telegram" : {
   "botToken": "123987123:adfk2893r7akdskanfsdalskf",
}

Enabling & configuring Pushbullet

Pushbullet is enabled by adding a pushbullet property to settings.json. The following options are supported:

Property Description Example
accessToken Required. The access token for your Pushbullet account. "o.asdfxknsdl234sdn"

The accessToken is obtained from your Pushbullet account settings page.

Example configuration for pushbullet integration

"pushbullet" : {
   "accessToken": "o.asdfxknsdl234sdn",
}

Enabling & configuring Pushover

Pushover is enabled by adding a pushover property to settings.json. The following options are supported:

Property Description Example
apiKey Required. The apiKey token for your Pushover app. "asdflj234xvnmwekl234"
enabled If true then Pushover is enabled. Optional. Default true. false
userKey Required. The userKey token for your Pushover account. "4dkgj34sdfn430234"

The apiKey is created at the Pushover apps page.

Example configuration for Pushover integration

"pushover" : {
   "apiKey": "asdflj234xvnmwekl234",
   "userKey": "4dkgj34sdfn430234"
}
Clone this wiki locally