pi_portal/schema/config_schema.json

  1{
  2  "$schema": "http://json-schema.org/draft-07/schema#",
  3  "description": "Pi Portal Config File Schema v1.11",
  4  "definitions": {
  5    "constantOnOff": {
  6      "type": "string",
  7      "pattern": "^on|off$"
  8    }
  9  },
 10  "type": "object",
 11  "properties": {
 12    "ARCHIVAL": {
 13      "description": "Archival integration configuration.",
 14      "type": "object",
 15      "properties": {
 16        "AWS": {
 17          "description": "The AWS archival integration configuration.",
 18          "type": "object",
 19          "properties": {
 20            "AWS_ACCESS_KEY_ID": {
 21              "type": "string",
 22              "description": "The AWS access key credential with write access to the buckets."
 23            },
 24            "AWS_SECRET_ACCESS_KEY": {
 25              "type": "string",
 26              "description": "The AWS access secret key credential with write access to the buckets."
 27            },
 28            "AWS_S3_BUCKETS": {
 29              "type": "object",
 30              "properties": {
 31                "LOGS": {
 32                  "type": "string",
 33                  "description": "The name of the AWS S3 bucket to upload archived logs to."
 34                },
 35                "VIDEOS": {
 36                  "type": "string",
 37                  "description": "The name of the AWS S3 bucket to upload captured videos to."
 38                }
 39              },
 40              "required": [
 41                "LOGS",
 42                "VIDEOS"
 43              ]
 44            }
 45          },
 46          "required": [
 47            "AWS_ACCESS_KEY_ID",
 48            "AWS_SECRET_ACCESS_KEY",
 49            "AWS_S3_BUCKETS"
 50          ]
 51        }
 52      },
 53      "anyOf": [
 54        {
 55          "required": [
 56            "AWS"
 57          ]
 58        }
 59      ]
 60    },
 61    "CHAT": {
 62      "description": "Chat ops logging integration configuration.",
 63      "type": "object",
 64      "properties": {
 65        "SLACK": {
 66          "description": "Configuration for the Slack chat ops integration.",
 67          "type": "object",
 68          "properties": {
 69            "SLACK_APP_SIGNING_SECRET": {
 70              "type": "string",
 71              "description": "The secret value generated by Slack to validate messages from your bot."
 72            },
 73            "SLACK_APP_TOKEN": {
 74              "type": "string",
 75              "description": "The app token generated by Slack to allow your bot use websockets."
 76            },
 77            "SLACK_BOT_TOKEN": {
 78              "type": "string",
 79              "description": "The token generated by Slack when you created a bot app."
 80            },
 81            "SLACK_CHANNEL": {
 82              "type": "string",
 83              "description": "The plain human readable name of the Slack channel where messages should be posted."
 84            },
 85            "SLACK_CHANNEL_ID": {
 86              "type": "string",
 87              "description": "The ID of the slack channel.  Can be found at the bottom of the dialogue for 'View Channel Details > About'."
 88            },
 89            "SLACK_FILE_TRANSFER_TIMEOUT": {
 90              "type": "integer",
 91              "description": "The number of seconds to wait before timing out a file transfer."
 92            }
 93          },
 94          "required": [
 95            "SLACK_APP_SIGNING_SECRET",
 96            "SLACK_APP_TOKEN",
 97            "SLACK_BOT_TOKEN",
 98            "SLACK_CHANNEL",
 99            "SLACK_CHANNEL_ID",
100            "SLACK_FILE_TRANSFER_TIMEOUT"
101          ]
102        }
103      },
104      "anyOf": [
105        {
106          "required": [
107            "SLACK"
108          ]
109        }
110      ]
111    },
112    "LOGS": {
113      "description": "Logging integration configuration.",
114      "type": "object",
115      "properties": {
116        "LOGZ_IO": {
117          "description": "Configuration for the LogzIO logging integration.",
118          "type": "object",
119          "properties": {
120            "LOGZ_IO_TOKEN": {
121              "type": "string",
122              "description": "A token generated by log.io, which will be injected into streamed logs to identify your account."
123            }
124          },
125          "required": [
126            "LOGZ_IO_TOKEN"
127          ]
128        }
129      },
130      "anyOf": [
131        {
132          "required": [
133            "LOGZ_IO"
134          ]
135        }
136      ]
137    },
138    "CAMERA": {
139      "description": "Camera configuration.",
140      "type": "object",
141      "properties": {
142        "DISK_SPACE_MONITOR": {
143          "description": "Disk space monitor configuration.",
144          "type": "object",
145          "properties": {
146            "THRESHOLD": {
147              "description": "The amount of free space remaining (in megabytes) that prompts the camera to shutoff.",
148              "type": "number"
149            }
150          },
151          "required": [
152            "THRESHOLD"
153          ]
154        },
155        "MOTION": {
156          "description": "Motion image capture configuration.",
157          "type": "object",
158          "properties": {
159            "AUTHENTICATION": {
160              "description": "Localhost http authentication for camera control.",
161              "type": "object",
162              "properties": {
163                "USERNAME": {
164                  "description": "The authentication username.",
165                  "type": "string"
166                },
167                "PASSWORD": {
168                  "description": "The authentication password.",
169                  "type": "string"
170                }
171              },
172              "required": [
173                "USERNAME",
174                "PASSWORD"
175              ]
176            },
177            "CAMERAS": {
178              "description": "Configuration for each hardware camera.",
179              "type": "array",
180              "items": {
181                "type": "object",
182                "properties": {
183                  "DEVICE": {
184                    "description": "The video device your camera is mounted as.",
185                    "pattern": "^/dev/video[0-9]+$",
186                    "type": "string"
187                  },
188                  "IMAGE": {
189                    "description": "The image configuration settings for your camera.",
190                    "type": "object",
191                    "properties": {
192                      "FRAME_RATE": {
193                        "description": "Maximum number of frames to be captured per second. (0=disable)",
194                        "maximum": 100,
195                        "minimum": 2,
196                        "type": "number"
197                      },
198                      "WIDTH": {
199                        "description": "Image width (pixels). Valid range: Camera dependent.",
200                        "type": "number"
201                      },
202                      "HEIGHT": {
203                        "description": "Image height (pixels). Valid range: Camera dependent.",
204                        "type": "number"
205                      },
206                      "AUTO_BRIGHTNESS": {
207                        "description": "Let motion regulate the brightness of a video device.",
208                        "$ref": "#/definitions/constantOnOff"
209                      },
210                      "BRIGHTNESS": {
211                        "description": "Set the initial brightness of a video device.  This is the average value if AUTO_BRIGHTNESS is enabled.",
212                        "maximum": 255,
213                        "minimum": 0,
214                        "type": "number"
215                      },
216                      "CONTRAST": {
217                        "description": "Set the contrast of a video device.  0 is disabled.",
218                        "maximum": 255,
219                        "minimum": 0,
220                        "type": "number"
221                      },
222                      "SATURATION": {
223                        "description": "Set the saturation of a video device.  0 is disabled.",
224                        "maximum": 255,
225                        "minimum": 0,
226                        "type": "number"
227                      },
228                      "HUE": {
229                        "description": "Set the hue of a video device (NTSC feature). 0 is disabled.",
230                        "maximum": 255,
231                        "minimum": 0,
232                        "type": "number"
233                      }
234                    },
235                    "required": [
236                      "FRAME_RATE",
237                      "WIDTH",
238                      "HEIGHT",
239                      "AUTO_BRIGHTNESS",
240                      "BRIGHTNESS",
241                      "CONTRAST",
242                      "SATURATION",
243                      "HUE"
244                    ]
245                  }
246                },
247                "required": [
248                  "DEVICE",
249                  "IMAGE"
250                ]
251              }
252            },
253            "DETECTION": {
254              "description": "General motion detection configuration.",
255              "type": "object",
256              "properties": {
257                "THRESHOLD": {
258                  "description": "Threshold for number of changed pixels in an image that triggers motion detection.",
259                  "type": "number"
260                },
261                "EVENT_GAP": {
262                  "description": "The seconds of no motion detection that triggers the end of an event.",
263                  "type": "number"
264                }
265              },
266              "required": [
267                "THRESHOLD",
268                "EVENT_GAP"
269              ]
270            },
271            "MOVIES": {
272              "description": "Recorded movie configuration.",
273              "type": "object",
274              "properties": {
275                "LOCATE_MOTION_MODE": {
276                  "description": "Locate and draw a box around the moving object.",
277                  "$ref": "#/definitions/constantOnOff"
278                }
279              },
280              "required": [
281                "LOCATE_MOTION_MODE"
282              ]
283            },
284            "SNAPSHOTS": {
285              "description": "Snapshot image configuration.",
286              "type": "object",
287              "properties": {
288                "QUALITY": {
289                  "description": "The quality (in percent) to be used by the jpeg and webp compression.",
290                  "maximum": 100,
291                  "minimum": 0,
292                  "type": "number"
293                }
294              },
295              "required": [
296                "QUALITY"
297              ]
298            }
299          },
300          "required": [
301            "AUTHENTICATION",
302            "CAMERAS",
303            "DETECTION",
304            "MOVIES",
305            "SNAPSHOTS"
306          ]
307        }
308      },
309      "anyOf": [
310        {
311          "required": [
312            "DISK_SPACE_MONITOR",
313            "MOTION"
314          ]
315        }
316      ]
317    },
318    "SWITCHES": {
319      "description": "Configured switches.",
320      "type": "object",
321      "properties": {
322        "CONTACT_SWITCHES": {
323          "description": "Configured contact switches.",
324          "type": "array",
325          "items": {
326            "type": "object",
327            "properties": {
328              "NAME": {
329                "description": "The name of the switch as it will appear in notifications and logs (ie. Front Door).",
330                "type": "string"
331              },
332              "GPIO": {
333                "description": "The GPIO number this contact switch connects to.",
334                "type": "number"
335              }
336            },
337            "required": [
338              "NAME",
339              "GPIO"
340            ]
341          }
342        }
343      },
344      "required": [
345        "CONTACT_SWITCHES"
346      ]
347    },
348    "TEMPERATURE_SENSORS": {
349      "description": "Configured temperature sensors.",
350      "type": "object",
351      "properties": {
352        "DHT11_SENSORS": {
353          "description": "Configured DHT11 temperature sensors.",
354          "type": "array",
355          "items": {
356            "type": "object",
357            "properties": {
358              "NAME": {
359                "type": "string",
360                "description": "The name of the sensor as it will appear in notifications and logs (ie. Living Room)."
361              },
362              "GPIO": {
363                "type": "number",
364                "description": "The GPIO number this DHT11 sensor connects to."
365              }
366            },
367            "required": [
368              "NAME",
369              "GPIO"
370            ]
371          }
372        }
373      },
374      "required": [
375        "DHT11"
376      ]
377    }
378  },
379  "required": [
380    "ARCHIVAL",
381    "CAMERA",
382    "CHAT",
383    "LOGS",
384    "SWITCHES",
385    "TEMPERATURE_SENSORS"
386  ]
387}