Skip to content

Lordnibbler/picframe-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

picframe-server

web frontend and python backend for picframe digital picture frame on raspberry pi

start it

source /home/pi/venv_picframe/bin/activate
pip install flask pyyaml ruamel.yaml  # only needed first time
python config.py

open your browser http://192.168.50.117:5000 (replace the IP obviously)

automatically start the web service on raspberry pi boot

make a new service:

mkdir -p /home/pi/.config/systemd/user
nano /home/pi/.config/systemd/user/picframe-web.service

paste this in the service file:

[Unit]
Description=PicFrame Web UI
After=network.target

[Service]
WorkingDirectory=/home/pi
ExecStart=/home/pi/venv_picframe/bin/python /home/pi/config.py
Restart=always
RestartSec=5

# optional but recommended
Environment=PICFRAME_WEB_SECRET=change-this

[Install]
WantedBy=default.target

enable the service:

systemctl --user daemon-reload
systemctl --user enable picframe-web.service
systemctl --user start picframe-web.service

automatically start the service on boot:

sudo loginctl enable-linger pi

check the service status:

systemctl status picframe-web.service

read logs if there are problems:

journalctl --user -u picframe-web.service -f

use hdmi cec from the rpi to turn on the tv on boot

If both the rpi and tv are on a smart switch together, you may wish for the rpi to tell the tv to turn on at boot time. If only the tv is on a smart switch proceed to the next section.

create systemd service file

sudo nano /etc/systemd/system/tv-on.service

paste this in

[Unit]
Description=Turn on TV via HDMI-CEC
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'sleep 5 && echo "on 0" | cec-client -s -d 1'

[Install]
WantedBy=multi-user.target

tell systemd about the service

sudo systemctl daemon-reexec
sudo systemctl daemon-reload

enable it at boot

sudo systemctl enable tv-on.service

test it once

sudo systemctl start tv-on.service

automatically turn on tv every 60 seconds

for an rpi on constant power and a tv on a smart switch you may wish to have the rpi turn the tv on automatically if there is power to it.

create systemd service

nano ~/.config/systemd/user/tv-wake.service

with contents

[Unit]
Description=Periodic HDMI-CEC TV Wake

[Service]
ExecStart=/home/pi/picframe-server/tv_wake.sh
Restart=always

[Install]
WantedBy=default.target

enable it

systemctl --user daemon-reload
systemctl --user enable --now tv-wake.service

enable VNC

ssh pi@192.168.50.117

# Then run:
sudo raspi-config

Go to: Interface Options → VNC → Enable

Exit and reboot (optional but safe):

sudo reboot

Most Raspberry Pi OS installs already include it, but just in case:

sudo apt update
sudo apt install realvnc-vnc-server realvnc-vnc-viewer

# Enable it:
sudo systemctl enable vncserver-x11-serviced
sudo systemctl start vncserver-x11-serviced

copy my config and start script to the rpi

scp "./configuration.yaml" pi@192.168.50.117:~/picframe_data/config/configuration.yaml
scp "./start_picframe.sh" pi@192.168.50.117:~/

auto mount the nas share for photos

sudo nano /etc/fstab

# paste in the contents of /etc/fstab from this repo

sudo reboot

About

web frontend and python backend for picframe digital picture frame on raspberry pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors