1
0
Fork 0
Original URL (with bug tracking etc.): https://sr.ht/~michalr/hswro-alarm-bot/
Go to file
Michał Rudowicz ed9981afbe HTTP Callback for activated alarm 2024-03-06 22:31:08 +01:00
.build.yml Reduce build output file size 2024-02-22 16:52:58 +01:00
.gitignore Mock time functions 2024-02-11 11:51:41 +01:00
.pre-commit-config.yaml Bump go-satel; remove throttling of messages 2024-03-05 22:30:48 +01:00
COPYING Initial commit 2024-02-08 19:23:46 +01:00
README.md HTTP Callback for activated alarm 2024-03-06 22:31:08 +01:00
data_store.go Retrieve partition names from Satel 2024-03-04 22:01:35 +01:00
filters.go Join filters etc. to limit numbers of goroutines that aren't needed 2024-03-05 23:01:38 +01:00
filters_test.go Join filters etc. to limit numbers of goroutines that aren't needed 2024-03-05 23:01:38 +01:00
go.mod Bump go-satel (polling for alarms) 2024-03-06 19:26:05 +01:00
go.sum Bump go-satel (polling for alarms) 2024-03-06 19:26:05 +01:00
main.go HTTP Callback for activated alarm 2024-03-06 22:31:08 +01:00
main_test.go Get persistence file path from $STATE_DIRECTORY 2024-03-03 13:54:42 +01:00
message_contents.go Fix PartitionAlarm 2024-03-06 19:47:26 +01:00
satel_utils.go Retrieve partition names from Satel 2024-03-04 22:01:35 +01:00
satel_utils_test.go Possibility to filter by ChangeType 2024-02-18 18:44:08 +01:00
sender_worker.go HTTP Callback for activated alarm 2024-03-06 22:31:08 +01:00
templates.go Retrieve partition names from Satel 2024-03-04 22:01:35 +01:00
templates_test.go Bump go-satel; remove throttling of messages 2024-03-05 22:30:48 +01:00
test_utils.go Bump go-satel; remove throttling of messages 2024-03-05 22:30:48 +01:00

README.md

Hackerspace Wroclaw Alarm Bot

builds.sr.ht status

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 armed
  • NOTIFY_URL_DISARM - for an URL that will be POST when partition 0 is unarmed
  • ALARM_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-violation
  • zone-tamper
  • zone-alarm
  • zone-tamper-alarm
  • zone-alarm-memory
  • zone-tamper-alarm-memory
  • zone-bypass
  • zone-no-violation-trouble
  • zone-long-violation-trouble
  • armed-partition-suppressed
  • armed-partition
  • partition-armed-mode-2
  • partition-armed-mode-3
  • partition-with-1st-code-enter
  • partition-entry-time
  • partition-exit-time-over-10s
  • partition-exit-time-under-10s
  • partition-temporary-blocked
  • partition-blocked-guard-round
  • partition-alarm
  • partition-fire-alarm
  • partition-alarm-memory
  • partition-fire-alarm-memory
  • output
  • doors-opened
  • doors-opened-long
  • status-bit
  • trouble-part-1
  • trouble-part-2
  • trouble-part-3
  • trouble-part-4
  • trouble-part-5
  • trouble-memory-part-1
  • trouble-memory-part-2
  • trouble-memory-part-3
  • trouble-memory-part-4
  • trouble-memory-part-5
  • partition-with-violated-zones
  • zone-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.