Monitor configurable MQTT topics and forward the messages to ntfy.sh topics.
Project description
NSP Ntfy
The Night Sky Pi can be configured to publish messages to a local MQTT broker. The NSP-NTFY module can be configured to listen to these notifactions and publish the notification field to ntfy.sh. This is so push notifications can be recieved on other devices without having to make the broker on the device public with routing.
Prerequisites
Before deploying the nsp-ntfy it's important to ensure that you have the following configured as there are dependencies. However the installation of an MQTT broker is optional I usually have it installed instead of needing to remember to do it when starting up other applications.
Python
nsp-ntfy is written in Python and has been tested with the following Python versions:
- Python 3.12
MQTT Broker
Night Sky Pi has the ability to publish events to an MQTT broker. The intent of this is so that other modules can react to the events to complete additional actions. Initially this broker will only run locally therefore only allow clients that reside on the same device as intended. Firstly we need to install MQTT on the Raspberry Pi.
sudo apt update && sudo apt upgrade
sudo apt install -y mosquitto
sudo apt install -y mosquitto-clients # Optional for testing locally
sudo systemctl enable mosquitto.service
sudo reboot # Just something I like to do, this is optional as well
The next step is to configure the nsp-ntfy to use the MQTT broker, as MQTT events are disabled by default. These configuration items are in the nsp configuration not the configuration of the nsp-ntfy module.
"device" : {
"mqtt" : {
"enabled": true,
"host": "127.0.0.1"
}
}
Running NSP-NTFY
It's recommended that nsp-ntfy is run as a service. This ensures that it doesn't stop of user logging off and on system restarts to do this carry out the following.
pip install nsp-ntfy
sudo nano /etc/systemd/system/nsp.service
Next step is to update the service definition to the correct paths and running as the correct user.
[Unit]
Description=nsp-ntfy
After=network.target
[Service]
Type=Simple
# update this to be your current user
User=username
# the location of the nsp-ntfy to work within
WorkingDirectory=/home/username/
# update these paths to be the location of the nsp-ntfy.sh
# update argument to where you previously copied the json configuration.
ExecStart=nsp-ntfy /home/username/nsp-ntfy-config.json /home/username/nsp-config.json
Restart=on-failure
[Install]
WantedBy=multi-user.target
Next is to enable and start the service.
sudo systemctl daemon-reload
sudo systemctl start nsp-ntfy
sudo systemctl enable nsp-ntfy
Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nsp_ntfy-2.0.1.tar.gz.
File metadata
- Download URL: nsp_ntfy-2.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41ab69c990ef09f7df22cef0416fa7b00441a867afdef4fa76acf12c38b87901
|
|
| MD5 |
d1451a10c71845724fb2643fcd899d87
|
|
| BLAKE2b-256 |
0d4661b7ab5242b1c6a661c3d2eefc8a43f46254db53fd13d8087fca3a48cdb6
|
Provenance
The following attestation bundles were made for nsp_ntfy-2.0.1.tar.gz:
Publisher:
publish.yml on joe-mccarthy/nsp-ntfy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nsp_ntfy-2.0.1.tar.gz -
Subject digest:
41ab69c990ef09f7df22cef0416fa7b00441a867afdef4fa76acf12c38b87901 - Sigstore transparency entry: 189812705
- Sigstore integration time:
-
Permalink:
joe-mccarthy/nsp-ntfy@a4122f847a073b6176e7cdf3547c25988cc67540 -
Branch / Tag:
refs/tags/2.0.1 - Owner: https://github.com/joe-mccarthy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4122f847a073b6176e7cdf3547c25988cc67540 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nsp_ntfy-2.0.1-py3-none-any.whl.
File metadata
- Download URL: nsp_ntfy-2.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65c5fb7fce2944570e5b2b5f26da3b388250c892d86ac50b7d802c8353173350
|
|
| MD5 |
a89944f21237cff5918ea05a0555cb39
|
|
| BLAKE2b-256 |
135a0043555bc87a7175e3916475276c93fa9de2e44defd633b6aa02e0cee275
|
Provenance
The following attestation bundles were made for nsp_ntfy-2.0.1-py3-none-any.whl:
Publisher:
publish.yml on joe-mccarthy/nsp-ntfy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nsp_ntfy-2.0.1-py3-none-any.whl -
Subject digest:
65c5fb7fce2944570e5b2b5f26da3b388250c892d86ac50b7d802c8353173350 - Sigstore transparency entry: 189812706
- Sigstore integration time:
-
Permalink:
joe-mccarthy/nsp-ntfy@a4122f847a073b6176e7cdf3547c25988cc67540 -
Branch / Tag:
refs/tags/2.0.1 - Owner: https://github.com/joe-mccarthy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4122f847a073b6176e7cdf3547c25988cc67540 -
Trigger Event:
push
-
Statement type: