GithubHelp home page GithubHelp logo

bizley / pi-mirror Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 332 KB

m-mirror interface

License: Other

CSS 4.02% PHP 75.27% JavaScript 16.59% Batchfile 1.26% Dockerfile 1.13% Python 1.73%
pi raspberry-pi mirror weather camera hacktoberfest

pi-mirror's Introduction

PI Mirror Display Interface

Yii 2 config:

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 Env

docker-compose is located in ./docker folder.

Raspbian:

/boot/config.txt

Disable camera LED:

disable_camera_led=1

Rotate HDMI display 90 degrees:

display_hdmi_rotate=1

~/.config/lxsession/LXDE-pi/autostart

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

Motion:

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

/etc/default/motion

start_motion_daemon=yes

/etc/motion/motion.conf

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 [email protected]

Email alerts:

sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo apt-get install mpack

/etc/ssmtp/ssmtp.conf

root=postmaster
mailhub=smtp.gmail.com:587
hostname=ras-pi
[email protected]
AuthPass=YourGmailPass
FromLineOverride=YES
UseSTARTTLS=YES

This may require switching less secured apps access on your Gmail account.

Controlling Motion

Go to the URL: http://your-pi-local-ip:8080/

PIR Sensor script for powering monitor

~/pir.py

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()

/etc/rc.local

Add before Exit 0

python3 /home/pi/pir.py > /dev/null 2>&1 &

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.