Create ./config/param-local.php
file with:
<?php
return [
'apiKey' => 'Open Weather Map API Key',
'units' => 'metric', // *OWM
'lang' => 'pl', // *OWM
'cacheDuration' => 600, // Yii cache duration
'latitude' => 0.000, // Your location latitude
'longitude' => 0.000, // Your location longitude
];
*OWM
= See https://openweathermap.org/api/one-call-api for options
docker-compose
is located in ./docker
folder.
Disable camera LED:
disable_camera_led=1
Rotate HDMI display 90 degrees:
display_hdmi_rotate=1
Run Chromium in kiosk mode with Open Weather Map interface:
@chromium-browser -kiosk -noerrdialogs --disable-session-crashed-bubble http://localhost:8000
Hide cursor:
@unclutter -idle 0
Requires unclutter
to be installed (sudo apt-get install unclutter
).
sudo apt-get install motion
Run:
sudo systemctl enable motion
Verify with:
sudo service motion status
Prepare a folder for images and videos:
mkdir ~/motion
start_motion_daemon=yes
daemon on
width 800
height 600
output_pictures best
locate_motion_mode on
locate_motion_style cross
target_dir /home/pi/motion
stream_port 0
webcontrol_localhost off
on_picture_save mpack -s "Motion detected!" %f your@gmail.com
sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo apt-get install mpack
root=postmaster
mailhub=smtp.gmail.com:587
hostname=ras-pi
AuthUser=yourGmailUser@gmail.com
AuthPass=YourGmailPass
FromLineOverride=YES
UseSTARTTLS=YES
This may require switching less secured apps access on your Gmail account.
Go to the URL: http://your-pi-local-ip:8080/
import RPi.GPIO as GPIO
import time
import subprocess
SENSOR_PIN = 23
screenOn = 1
eventTime = time.time()
GPIO.setmode(GPIO.BCM)
GPIO.setup(SENSOR_PIN, GPIO.IN)
def powerOn(channel):
global screenOn
global eventTime
eventTime = time.time()
if screenOn == 0:
subprocess.run(["vcgencmd", "display_power", "1"])
screenOn = 1
try:
GPIO.add_event_detect(SENSOR_PIN , GPIO.RISING, callback=powerOn)
while True:
time.sleep(10)
if screenOn == 1 and time.time() - eventTime > 30:
subprocess.run(["vcgencmd", "display_power", "0"])
screenOn = 0
except KeyboardInterrupt:
print("Motion detector switched off...")
GPIO.cleanup()
Add before Exit 0
python3 /home/pi/pir.py > /dev/null 2>&1 &