Skip to content

Configuration

Neil Enns edited this page Jun 12, 2020 · 19 revisions

Enabling & configuring MQTT

MQTT is enabled by un-commenting the - mqtt line in the docker-compose.yml file. See the comment above the line in the file to be sure the right line is changed.

MQTT is configured using the mqtt.conf file. The following properties are supported:

Property Description Example
uri Required. The address of the MQTT server. "mqtt://192.168.1.100:1883"
username Optional. The username to log into the server with. "mqttuser"
password Optional. The password to log into the server with. "mqttpass"
rejectUnauthorized Optional. Default true. 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. false
statusTopic Optional. The topic to send status messages to. Defaults to node-deepstack-ai/status. "aimotion/status"

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.

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 un-commenting the - telegram line in the docker-compose.yml file. See the comment above the line in the file to be sure the right line is changed.

Telegram is configured using the telegram.conf file. The following properties are supported:

Property Description Example
botToken Required. The bot token for your Telegram bot server. "123987123:adfk2893r7akdskanfsdalskf"

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"}}]}
Clone this wiki locally