For my Rasberry Pi 3 running OSMC, I have been looking to use it as a photo frame in my store that automatically turns on in the morning when I open, and turns off when I close. I am not exactly a pro when it comes to coding, but I was wondering if anyone has the line of code that is able to do so.
There are a lot of tutorials on using a raspberry as a photoframe.
Why exactly do you need osmc for the job?
I do something a bit similar with osmc. The trouble with the Pi is there is no wake-on-lan support, so turning the system completely off is troublesome. What I do is turn the HDMI port off at the end of business hours, then do a reboot at the start of business hours. By turning off the HDMI port, the TV is set to turn off if no input is detected. On reboot, a startup script is executed.
I use an autoexec.py
file that, among other things, starts a slideshow (or plays some kind of media) on boot.
So, you would place the autoexec.py file in ~/.kodi/userdata/autoexec.py
– The script itself may be as simple as follows:
#! /usr/bin/python
import xbmc
xbmc.executebuiltin('SlideShow("/home/osmc/myphotos")')
You may or may not have to do a chmod +x
on the file to make it executable.
Alternatively, you can turn the Pi off with a scheduled shutdown and reboot it using something like a physical timer on the outlet powering the Pi, using the same startup autoexec.py
script.