RaspController notifications
Project description
raspc-notif
A simple Python library that allows you to send custom notifications from your Raspberry Pi directly to the RaspController mobile app.
This allows you to create custom scripts (e.g., monitoring temperature, checking for completed processes, security alerts) and receive real-time alerts on your phone.
Requirements
Before you begin, please ensure you meet the following requirements:
-
RaspController PRO Version The "Notifications" feature is only available in the PRO version of the RaspController application.
-
Registration & API Key To send notifications from your Raspberry Pi to the app, you need to be registered.
- Open the RaspController app on your mobile device.
- Navigate to the “Raspberry Pi Notifications” section.
- Register or Log in to the service.
- Once logged in, take note of your User API Key. You will need this key for your Python script.
-
Internet Connection To successfully send and receive notifications, both your Raspberry Pi and your mobile device (running RaspController) must be connected to the internet.
-
More informations For complete information on using the library, advanced options, and all available features, please visit the official page: https://www.egalnetsoftwares.com/apps/raspcontroller/send_notifications/
Documentation
For a detailed technical breakdown of all available classes, methods, and parameters within the raspc-notif library, you can access the full API reference documentation here:
https://www.egalnetsoftwares.com/files/raspcontroller/raspc_notif_lib_docs/
Usage Example
Here is a basic example of how to use the raspc-notif library in your Python script. This example monitors the Raspberry Pi's CPU temperature and sends a high-priority notification if it exceeds 70°C.
from raspc_notif import notif
from time import sleep
import subprocess
# ------------------------------------------------------------------
# IMPORTANT: Enter the User API Key you find in the RaspController app
# ------------------------------------------------------------------
sender = notif.Sender(apikey = "YOUR_API_KEY_HERE")
# Infinite loop to continuously get data
while True:
# Gets data once every 5 seconds
sleep(5)
# Gets the CPU temperature
try:
cpu_temp_str = subprocess.check_output(["cat", "/sys/class/thermal/thermal_zone0/temp"]).decode("utf-8").strip()
cpu_temp = float(cpu_temp_str) / 1000
except Exception as e:
print(f"Could not read temperature: {e}")
continue
# Check if the temperature exceeds a certain threshold
if cpu_temp > 70:
# Send notification to RaspController
notif_message = f"The CPU has reached the temperature of {cpu_temp}^C"
notification = notif.Notification("Attention!", notif_message, high_priority = True)
print(f"Temperature threshold exceeded ({cpu_temp}^C). Sending notification...")
result = sender.send_notification(notification)
# Check if the submission was successful
if result.status == notif.Result.SUCCESS:
print(result.message)
else:
print(f"ERROR: {result.message}")
# Wait 6 minutes before sending a notification again
# This prevents spamming notifications
if result.status != notif.Result.SOCKET_ERROR:
sleep(60 * 6)
Note: Remember to replace "YOUR_API_KEY_HERE" with the actual User API Key you got from the RaspController app.
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 raspc_notif-1.1.1.tar.gz.
File metadata
- Download URL: raspc_notif-1.1.1.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76ff434cab6484ec07cf80a3697be55f495918ed7832371bf61db7409528923e
|
|
| MD5 |
3be996c053d8a83c029dd7897b4c9069
|
|
| BLAKE2b-256 |
cff57776f165993c6dc76bcc7a8aa90fb73717a34385b246c7bce530645f42ab
|
File details
Details for the file raspc_notif-1.1.1-py3-none-any.whl.
File metadata
- Download URL: raspc_notif-1.1.1-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6abdd5cf402e6b2ba300c3b987fe0655dec018db825d50b52a3bd342ea19daa
|
|
| MD5 |
89772f096f0720899ae7e918db41c1c1
|
|
| BLAKE2b-256 |
918c3c8c99b96fa906faaf52f6832f9de962839c0672e57584fb218a18dabcf9
|