Skip to main content

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:

  1. RaspController PRO Version The "Notifications" feature is only available in the PRO version of the RaspController application.

  2. 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.
  3. Internet Connection To successfully send and receive notifications, both your Raspberry Pi and your mobile device (running RaspController) must be connected to the internet.

  4. 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.

Release files for raspc-notif 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raspc-notif 1.1.1
File Size Uploaded
raspc_notif-1.1.1.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for raspc-notif 1.1.1
File Interpreter ABI Platform
raspc_notif-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 60.8 kB

Release files / raspc_notif-1.1.1.tar.gz

Download URL raspc_notif-1.1.1.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
76ff434cab6484ec07cf80a3697be55f495918ed7832371bf61db7409528923e
BLAKE2b-256 checksum
How to use checksums
cff57776f165993c6dc76bcc7a8aa90fb73717a34385b246c7bce530645f42ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / raspc_notif-1.1.1-py3-none-any.whl

Download URL raspc_notif-1.1.1-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6abdd5cf402e6b2ba300c3b987fe0655dec018db825d50b52a3bd342ea19daa
BLAKE2b-256 checksum
How to use checksums
918c3c8c99b96fa906faaf52f6832f9de962839c0672e57584fb218a18dabcf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page