*) technically the memory could still be referenced, so some would argue that it was not a memory leak, but when I see a program balooning up without a reason for it so OOM Killer deals with it I call it a memory leak, sue me |
||
|---|---|---|
| .build.yml | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| COPYING | ||
| README.md | ||
| data_store.go | ||
| filters.go | ||
| filters_test.go | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| main_test.go | ||
| message_contents.go | ||
| satel_utils.go | ||
| satel_utils_test.go | ||
| sender_worker.go | ||
| templates.go | ||
| templates_test.go | ||
| test_utils.go | ||
README.md
Hackerspace Wroclaw Alarm Bot
Warning: this is a proof of concept, don't rely on it
I didn't even test it yet so no idea if it works
Usage
$ TELEGRAM_APITOKEN=YOUR_API_TOKEN ./alarm_bot --satel_addr=127.0.0.1 --satel_port=31337 --tg_chat_id=YOUR_CHAT_ID_FROM_BOTFATHER
Notification via HTTP callbacks
Set the following environment variables:
NOTIFY_URL_ARM- for an URL that will be POST when partition 0 is armedNOTIFY_URL_DISARM- for an URL that will be POST when partition 0 is unarmedALARM_URL_ARM- for an URL that will be POST when any partition alarm is activated
Filtering events by change type
It's possible to filter events by change type. Use the --allowed-types=TYPE1,TYPE2,... command line parameter to do that. If that parameter is not provided, then all change types are allowed, otherwise only the provided ones will be used for notifications.
Supported types are:
zone-violationzone-tamperzone-alarmzone-tamper-alarmzone-alarm-memoryzone-tamper-alarm-memoryzone-bypasszone-no-violation-troublezone-long-violation-troublearmed-partition-suppressedarmed-partitionpartition-armed-mode-2partition-armed-mode-3partition-with-1st-code-enterpartition-entry-timepartition-exit-time-over-10spartition-exit-time-under-10spartition-temporary-blockedpartition-blocked-guard-roundpartition-alarmpartition-fire-alarmpartition-alarm-memorypartition-fire-alarm-memoryoutputdoors-openeddoors-opened-longstatus-bittrouble-part-1trouble-part-2trouble-part-3trouble-part-4trouble-part-5trouble-memory-part-1trouble-memory-part-2trouble-memory-part-3trouble-memory-part-4trouble-memory-part-5partition-with-violated-zoneszone-isolate
Filtering events by index (I guess "zone", but I'm not sure)
Use the --allowed-indexes=1,2,3,... command line parameter to set the list of allowed indexes (of course provide your own list instead of 1,2,3,...). If that parameter is not provided, then all indexes are allowed; otherwise the notification is sent for all indexes.
Debugging
Set the OMIT_TG environment variable to, well, omit sending anything over to Telegram and just see the logs instead.