Code: Alles auswählen
status: fail
reason: old_version
login: 491xxxxxxxxx
Achja, Raspberry Image ist das aktuelle Raspbian Jessi lite.
Und Python 3.5
Code: Alles auswählen
status: fail
reason: old_version
login: 491xxxxxxxxx
Code: Alles auswählen
#!/bin/bash
API= "mein code"
MSG="$1"
curl -u $API: https://api.pushbullet.com/v2/pushes -d type=note -d title="Alert" -d body="$MSG"
Code: Alles auswählen
{"error":{"code":"invalid_request","type":"invalid_request","message":"The resource could not be found.","cat":"~(=^‥^)"},"error_code":"invalid_request"}curl: (6) Could not resolve host: body=Hello World!
Aus Interesse: Warum möchtest du das nicht? Geht es um Größenbeschränkungen oder Sicherheitsbedenken? Prinzipiell wäre eine Variante sonst, die Bilder auf einen (Web)server zu kopieren und per Mail den Link zu verteilenegon11 hat geschrieben: Aber wenn das nicht geht, dann muss ich mir was anderes einfallen lassen (e-mail möchte ich nicht).
Code: Alles auswählen
#!/bin/bash
MSG="$1"
curl -u xxxxxxxxxxxxxxxx: https://api.pushbullet.com/v2/pushes -d type=note -d title="Alert" -d body="$MSG"
Code: Alles auswählen
#!usr/bin/python3
# Datei sensor.py
import sys
import time
import RPi.GPIO as GPIO
import os
import picamera
import datetime
GPIO.setmode (GPIO.BOARD)
GPIO.setup (11, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup (32, GPIO.OUT)
#cam = picamera.PiCamera()
#cam.resolution = (1920,1080)
def motion (pin):
t = time.strftime('%d.%m.%Y %H:%M:%S')
GPIO.output(32, GPIO.HIGH)
time.sleep(1)
GPIO.output (32, GPIO.LOW)
# cam.capture ('/home/%s.jpg' %t)
os.system('/usr/bin/pushpullet.sh "bewegung"')
return
GPIO.add_event_detect (11, GPIO.RISING)
GPIO.add_event_callback (11, motion)
try:
while True:
time.sleep (0.5)
except KeyboardInterrupt:
GPIO.cleanup ()
sys.exit ()
Code: Alles auswählen
#!usr/bin/python3
import sys
import time
import RPi.GPIO as GPIO
import os
import picamera
import datetime
from pushbullet import Pushbullet
pb = Pushbullet('xxxxxxxxxxxxxx')
GPIO.setmode (GPIO.BOARD)
GPIO.setup (11, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup (32, GPIO.OUT)
cam = picamera.PiCamera()
cam.resolution = (1920,1080)
def motion (pin):
t = time.strftime('%d.%m.%Y %H:%M:%S')
GPIO.output(32, GPIO.HIGH)
time.sleep(1)
GPIO.output (32, GPIO.LOW)
cam.capture ('/home/pi/%s.jpg' %t)
cam.capture ('/home/1.jpg')
with open("/home/1.jpg", "rb") as pic:
file_data = pb.upload_file(pic, "da")
push = pb.push_file(**file_data)
return
GPIO.add_event_detect (11, GPIO.RISING)
GPIO.add_event_callback (11, motion)
try:
while True:
time.sleep (0.5)
except KeyboardInterrupt:
GPIO.cleanup ()
sys.exit ()