- Python 98.7%
- Dockerfile 1.3%
| diverapusher | Revert "import: asyncio into diverapusher/callbacks/base.py" | |
| tests | test: test obtaining handler with no callback definition set | |
| compose.yml | add config volume to compose.yml | |
| Dockerfile | specify the default config location | |
| LICENSE | license: add AGPLv3 license | |
| pyproject.toml | dep: update divera-python to v0.9.6 | |
| README.md | readme: start section explaining how to restrict callbacks to only be run for certain models | |
Divera Pusher
Forward notifications from your alerting service to your favorite push service in real time.
Setup
Build the container image
This repo provides a Dockerfile which can be used to build a container image.
Docker
docker compose build
Podman
podman compose build
Run the setup script
If you use docker or podman you need to prefix the command with docker compose run divera-pusher or podman compose run divera-pusher
poetry run setup
You will be prompted for the url to your divera instance and your access token.
The access token might also be labeled as accesskey or debug token and can be found in your divera settings in the debug section.
Warning
Be very careful with this access token. It cannot be changed and might therefor be even more critical than your password.
Configuration
These are example configs to help you get started modifying your own config located at ~/.config/divera-pusher/diverapusher.json.
Please take a look at the chapter down below for more info on how to do configuration.
Forward status changes to your phone using unifiedpush
Requires:
- a Nextcloud instance with UnifiedPush Provider installed
- NextPush installed on your phone
The url for the following example can be obtained by adding a notification channel from within NextPush and copying its url to the clipboard.
{
"handlers": [
{
"trigger": "divera.triggers.socketevents.UserStatusChange",
"callback": {
"path": "diverapusher.callbacks.unifiedpush.UserStatusChanged",
"kwargs": {
"url": "https://<your.nextcloud.com>/index.php/apps/uppush/push/<your topic>",
"template": "Status set: {{ status.name }}"
}
}
}
],
"logging": {
"format": "{asctime} - {levelname} - {message}",
"style": "{",
"level": "INFO"
}
}
Run
If you use docker or podman you need to prefix the command with docker compose run divera-pusher or podman compose run divera-pusher .
poetry run diverapusher
More on config
Model specific callbacks
If the trigger object has an object attribute set, you can restrict the handler to only act if type(trigger.object) matches any item in a given definition.
Unrestricted:
{
"handlers": [
{
"trigger": "divera.triggers.ObjectCreated",
...
}
]
}
Restricted to only be called for divera.Alarm objects:
{
"handlers": [
{
"trigger": {
"trigger": "divera.triggers.ObjectCreated",
"filter": [
"divera.Alarm"
]
},
...
}
]
}