Documentation
This commit is contained in:
parent
64780e249c
commit
7e9c341270
72
README.md
72
README.md
|
@ -7,24 +7,74 @@ Warning: this is a proof of concept, don't rely on it
|
|||
It was very basically tested, and while it seems to work, approach it without any expectations.
|
||||
In other words - treat it as a toy, not as a tool that will save your life or valuables, because it probably won't.
|
||||
|
||||
## Usage
|
||||
|
||||
## Running
|
||||
|
||||
```
|
||||
$ TELEGRAM_APITOKEN=YOUR_API_TOKEN ./alarm_bot --satel_addr=127.0.0.1 --satel_port=31337 --tg_chat_id=YOUR_CHAT_ID_FROM_BOTFATHER
|
||||
$ TELEGRAM_APITOKEN=YOUR_API_TOKEN ./alarm-bot
|
||||
```
|
||||
|
||||
Remember that `hswro-alarm-bot.yml` should be present in the current directory.
|
||||
|
||||
## Configuration via YAML file
|
||||
|
||||
Configuration should be stored in `hswro-alarm-bot.yml` in current directory.
|
||||
|
||||
```yaml
|
||||
satel-addr: "192.168.13.37"
|
||||
tg-chat-ids:
|
||||
- 1234
|
||||
- 5678
|
||||
- 9876
|
||||
allowed-types:
|
||||
- "zone-isolate"
|
||||
- "zone-alarm"
|
||||
allowed-indexes:
|
||||
- 5678
|
||||
- 1337
|
||||
pool-interval: 5m
|
||||
arm-callback-urls:
|
||||
- "http://192.168.1.10/hello"
|
||||
- "http://example.com/api"
|
||||
disarm-callback-urls:
|
||||
- "http://192.168.1.10/bye"
|
||||
- "http://example.com/api2"
|
||||
alarm-callback-urls:
|
||||
- "http://192.168.1.10/ohno"
|
||||
- "http://example.com/api3"
|
||||
matterbridge:
|
||||
- uri: "http://localhost:4242/api/message"
|
||||
token: "test_token_1"
|
||||
gateway: "test_gateway_1"
|
||||
username: "test_username_1"
|
||||
```
|
||||
|
||||
- `pool-interval` sets how often will the Satel device be asked for changes
|
||||
- `satel-addr` sets the IP address of the Satel device
|
||||
- `tg-chat-ids` sets which telegram groups will receive notifications about alarm state changes
|
||||
|
||||
### Matterbridge integration
|
||||
|
||||
As Telegram is kinda questionable it's beneficial to get the notifications somewhere else as well. This bot can utilize Matterbridge's API to send notifications to many different chat platforms. Check the [Matterbridge API documentation](https://github.com/42wim/matterbridge/wiki/Api) to learn how to configure your existing MAtterbridge installation.
|
||||
|
||||
Tip: You can still have independent Telegram and Matterbridge notifications - simply set up an additional gateway in Matterbridge that pushes the messages to your non-telegram chat groups but omits the Telegram group to avoid duplicated messages. Those other chat groups can be the same as those where your regular messages are bridged - Matterbridge will handle that just fine without the need for duplicated bots etc.
|
||||
|
||||
To configure that set the `matterbridge` part of the config file with the following parameters:
|
||||
- `uri` - URI to your Matterbridge's API
|
||||
- `token` - Token that you've set up for yout Matterbridge API. Situation where this token is not configured is not taken into account.
|
||||
- `gateway` - Set it to the same value that is set in the `name` parameter to your `[[gateway]]` in `matterbridge.toml`
|
||||
- `username` - The username from which the alarm bot messages will appear to API.
|
||||
|
||||
### Notification via HTTP callbacks
|
||||
|
||||
Set the following environment variables:
|
||||
Set the values in following parts of the config file:
|
||||
|
||||
- `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
|
||||
- `arm-callback-urls` - for an URL that will be POST when partition **0** is armed
|
||||
- `disarm-callback-urls` - for an URL that will be POST when partition **0** is unarmed
|
||||
- `alarm-callback-urls` - 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.
|
||||
It's possible to filter events by change type. Use the `allowed-types` part of the config file 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`
|
||||
|
@ -69,7 +119,7 @@ Supported types are:
|
|||
|
||||
### Filtering events by index (which meaning depends on the change type)
|
||||
|
||||
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.
|
||||
Use the `allowed-indexes` part of config file to set the list of allowed indexes. If that parameter is not provided, then all indexes are allowed; otherwise the notification is sent only for provided indexes.
|
||||
|
||||
## example systemd unit
|
||||
|
||||
|
@ -81,10 +131,8 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/path/to/alarm_bot --satel-addr=192.168.13.37 --satel-port=7094 --tg-chat-id=1234,4567,9876
|
||||
ExecStart=/path/to/alarm_bot
|
||||
Environment=TELEGRAM_APITOKEN=YOUR_API_TOKEN
|
||||
Environment=NOTIFY_URL_DISARM="http://localhost/disarmed"
|
||||
Environment=NOTIFY_URL_ARM="http://localhost/armed"
|
||||
DynamicUser=True
|
||||
RuntimeDirectory=hswro-alarm-bot
|
||||
StateDirectory=hswro-alarm-bot
|
||||
|
|
Loading…
Reference in New Issue