Last active
January 3, 2023 12:43
-
-
Save PJTewkesbury/9e9556cd8f6adbb98255563ca7323842 to your computer and use it in GitHub Desktop.
Build ClockPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@lxpanel --profile LXDE-pi | |
@pcmanfm --desktop --profile LXDE-pi | |
#@xscreensaver -no-splash | |
point-rpi | |
@chromium-browser --start-fullscreen --start-maximized http://localhost:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script requires the following enviroment variables to be defined before calling this script. | |
IPADDR_ETH0="192.168.0.16" | |
IPADDR_WLAN0="192.168.0.17" | |
ROOTPW="ClockPIP@ssw0rd" | |
wget -O ./BuildPiCore.sh https://gist.github.com/PJTewkesbury/142815aace9f37f36fe8ef90cb683102/raw | |
chmod +x ./BuildPiCore.sh | |
source "./BuildPiCore.sh" | |
# Install Extra Shares | |
echo "Add extra Samba Shares" | |
echo | |
sudo echo "[MagicMirror]"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "comment = MagicMirror"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "path = /home/pi/MagicMirror"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "Browseable = yes"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "Writeable = Yes"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "only guest = no"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "create mask = 0777"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "directory mask = 0777"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "Public = yes"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "Guest ok = yes"| sudo tee -a /etc/samba/smb.conf | |
sudo echo "read only = no"| sudo tee -a /etc/samba/smb.conf | |
# Install Magic Mirror | |
# https://forum.magicmirror.builders/topic/236/complete-setup-tutorial/6 | |
cd /home/pi/ | |
bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/raspberry.sh)" | |
echo "lcd_rotate=2 # Rotate screen 180 degrees (landscape)" | sudo tee -a /boot/config.txt | |
echo "avoid_warnings=2 # Disable under-voltage warning" | sudo tee -a /boot/config.txt | |
echo "@xset s noblank" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart | |
echo "@xset s off" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart | |
echo "@xset -dpms" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart | |
echo "xserver-command=X -s 0 -dpms" | sudo tee -a /etc/lightdm/lightdm.conf | |
# wlan0 turn power management off | |
sudo sed -i '/^exit 0/i iwconfig wlan0 power off' /etc/rc.local | |
# Disable stuff that stops led screen working | |
sudo sed -i 's/otg_mode=1/#otg_mode=1/' /boot/config.txt | |
sudo sed -i 's/dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/' /boot/config.txt | |
sudo sed -i 's/max_framebuffers=2/#max_framebuffers=2/' /boot/config.txt | |
sudo sed -i 's/arm_boost=1/#arm_boost=1/' /boot/config.txt | |
# Get config | |
cd /home/pi/MagicMirror/config | |
rm /home/pi/MagicMirror/config/config.js | |
wget -O /home/pi/MagicMirror/config/config.js https://gist.githubusercontent.com/PJTewkesbury/9e9556cd8f6adbb98255563ca7323842/raw/3aba3f4bcab2503f37bc2402525496cfc103c46f/config.js | |
cd /home/pi/MagicMirror/css | |
rm /home/pi/MagicMirror/css/custom.css | |
wget -O /home/pi/MagicMirror/css/custom.css https://gist.githubusercontent.com/PJTewkesbury/9e9556cd8f6adbb98255563ca7323842/raw/022a0d5aa03cbc91ba5953c3395e265d99af0880/custom.css | |
# Make ClockPI run Chrome on startup | |
cd /home/pi | |
mkdir lxsession | |
cd lxsession | |
mkdir LXDE-pi | |
cd LXDE-pi | |
wget -O /home/pi/lxsession/LXDE-pi/autostart https://gist.githubusercontent.com/PJTewkesbury/9e9556cd8f6adbb98255563ca7323842/raw/022a0d5aa03cbc91ba5953c3395e265d99af0880/autostart | |
# Install Modules | |
cd /home/pi/MagicMirror/modules | |
# git clone | |
git clone https://github.com/ianperrin/MMM-ModuleScheduler.git | |
cd MMM-ModuleScheduler | |
npm install --production | |
cd .. | |
git clone https://github.com/edward-shen/MMM-page-indicator.git | |
git clone https://github.com/edward-shen/MMM-pages.git | |
git clone https://github.com/PjTewkesbury/MMM-PlexSlideshow | |
cd MMM-PlexSlideshow | |
npm install --production | |
cd .. | |
git clone https://github.com/PjTewkesbury/MMM-WebHookAlerts | |
cd MMM-WebHookAlerts | |
npm install --production | |
cd .. | |
git clone https://github.com/Jopyth/MMM-Remote-Control.git | |
cd MMM-Remote-Control | |
npm install | |
cd .. | |
git clone https://github.com/jc21/MMM-Sounds.git | |
cd MMM-Sounds | |
npm install | |
cd .. | |
# Make MagicMirror node app run as service | |
wget -O /etc/systemd/system/MagicMirror.service https://gist.githubusercontent.com/PJTewkesbury/9e9556cd8f6adbb98255563ca7323842/raw/022a0d5aa03cbc91ba5953c3395e265d99af0880/MagicMirror.service | |
systemctl daemon-reload | |
systemcyl enable MagicMirror | |
echo | |
echo Remove old packages | |
echo | |
sudo apt autoremove -y | |
sudo apt autoclean -y | |
# Let me know. | |
curl -H "Title:ClockPI Build Complete" -d "Your ClockPI build has completed successfully" nfty.sh/7425168731 | |
# Send email | |
echo "ClockPI Build complete after reboot" | sendmail [email protected] | |
# Reboot when all installed | |
echo "All Done. Rebooting for changes to take effect" | |
echo | |
sudo reboot | |
reboot | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* MagicMirror² Config Sample | |
* | |
* By Michael Teeuw https://michaelteeuw.nl | |
* MIT Licensed. | |
* | |
* For more information on how you can configure this file | |
* see https://docs.magicmirror.builders/configuration/introduction.html | |
* and https://docs.magicmirror.builders/modules/configuration.html | |
*/ | |
let config = { | |
electronOptions: {}, | |
electronSwitches: ["ignore-certificate-errors"], | |
address: "0.0.0.0", // Address to listen on, can be: | |
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface | |
// - another specific IPv4/6 to listen on a specific interface | |
// - "0.0.0.0", "::" to listen on any interface | |
// Default, when address config is left out or empty, is "localhost" | |
port: 8080, | |
basePath: "/", // The URL path where MagicMirror² is hosted. If you are using a Reverse proxy | |
// you must set the sub path here. basePath must end with a / | |
ipWhitelist: [ | |
'127.0.0.1', | |
'::ffff:127.0.0.1', | |
'::1', | |
'::ffff:192.168.0.1/120', | |
'192.168.0.1/24', | |
], | |
useHttps: false, // Support HTTPS or not, default "false" will use HTTP | |
httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true | |
httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true | |
language: "en", | |
locale: "en-GB", | |
logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging | |
timeFormat: 24, | |
units: "metric", | |
// serverOnly: true/false/"local" , | |
// local for armv6l processors, default | |
// starts serveronly and then starts chrome browser | |
// false, default for all NON-armv6l devices | |
// true, force serveronly mode, because you want to.. no UI on this device | |
modules: [ | |
{ | |
module: "alert", | |
config: { | |
effect: "slide", | |
display_time: "90000", | |
position: "center" | |
} | |
}, | |
{ | |
module: "updatenotification", | |
position: "top_bar" | |
}, | |
{ | |
module: "clock", | |
position: 'top_left', | |
classes: 'nighttime_scheduler, scheduler', | |
config: {} | |
}, | |
{ | |
module: 'calendar', | |
position: 'top_left', | |
header: '', | |
classes: 'daytime_scheduler', | |
config: { | |
maximumEntries: 8, | |
maxTitleLength: 30, | |
wrapEvents: false, | |
urgency: 2, | |
getRelative: 12, | |
timeFormat: 'relative', | |
dateFormat: 'Do MMM', | |
fullDayEventDateFormat: 'Do MMM', | |
showLocation: false, | |
hideOngoing: true, | |
calendars: [ | |
{ | |
symbol: 'calendar-check-o', | |
url: 'webcal://www.calendarlabs.com/ical-calendar/ics/75/UK_Holidays.ics' | |
}, | |
{ | |
symbol: 'user', | |
url: 'webcal://outlook.live.com/owa//calendar/0705e40f-fdb6-4fd2-8de9-ad1e81b16f0c/23dedf1a-7ec7-4466-9462-347a705d409c/cid-6FB794A6157A8834/calendar.ics' | |
}, | |
{ | |
symbol: 'user', | |
url: 'https://outlook.live.com/owa//calendar/7d11b635-e5ac-4653-99f8-590f5840d2dc/d6623f3b-1c4c-4de5-9713-087d47786334/cid-6FB794A6157A8834/calendar.ics' | |
} | |
], | |
colored: true, | |
excludedEvents: ['(NIR)', '(SCT)'], | |
sliceMultiDayEvents: false | |
} | |
}, | |
{ | |
module: "weather", | |
position: "top_right", | |
classes: 'daytime_scheduler', | |
config: { | |
weatherProvider: "openweathermap", | |
type: "current", | |
showWindDirectionAsArrow: true, | |
location: "Marple", | |
locationID: "2642999", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city | |
apiKey: "4b1d26347f5dedfdc74bc7e330867ed0" | |
} | |
}, | |
{ | |
module: "weather", | |
position: "top_right", | |
header: "Weather Forecast", | |
classes: 'daytime_scheduler', | |
config: { | |
weatherProvider: "openweathermap", | |
type: "forecast", | |
location: "Marple", | |
locationID: "2642999", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city | |
apiKey: "4b1d26347f5dedfdc74bc7e330867ed0" | |
} | |
}, | |
{ | |
module: 'MMM-pages', | |
config: { | |
modules: | |
[ | |
["weather", "calendar", "weather"], | |
["MMM-PlexSlideshow"], | |
["MMM-PlexSlideshow", "MMM-NowPlayingOnSpotify", "MMM-PlexNowPlaying"] | |
], | |
fixed: ["clock", "MMM-page-indicator"] | |
} | |
}, | |
{ | |
module: 'MMM-page-indicator', | |
position: 'bottom_center', | |
config: { | |
pages: 3, | |
} | |
}, | |
{ | |
module: "MMM-NowPlayingOnSpotify", | |
position: "bottom_right", | |
config: { | |
showCoverArt: false, | |
clientID: "224349f8e7aa41bda2cfdc4d4081f426", | |
clientSecret: "3ee42fe27c144bea9d77302ee06f44b9", | |
accessToken: "BQDZ0L4Cijb2ZT-RZARQg4V1nGeP5y4YlysqWftDNML5hCIfXnQwKnab7nXrn7ewuZqDh_VUG_L-2h-kATdPj9StJdA_j3Z9Kwgis2_OJBbR4etI7h16Bwox5w1s9XveJwusGQsHM1SliGu-ZxrLjEfIAzStpdEWuvqzFt-tHnaNd85D-yHxGsoF", | |
refreshToken: "AQAkdn7QHl1ZZZvSnVXu-AQqlrH7MvYt7khuC0b2VFIpnaJbWVGJ4a_c-o2NPR_IStNyqA2J5Ow6BI0KLuUyRkXoIYrSX5VI9Iba9l8456u5PUqLb_z_tZM8ve418fwdUhQ" | |
} | |
}, | |
{ | |
module: 'MMM-ModuleScheduler', | |
config: { | |
debug: true, | |
global_schedule: [ | |
{ | |
from: '30 5 * * *', | |
to: '30 20 * * *', | |
groupClass: 'daytime_scheduler' | |
}, | |
{ | |
from: '30 20 * * *', | |
to: '30 22 * * *', | |
groupClass: 'nighttime_scheduler', | |
dimLevel: '20' | |
} | |
], | |
notification_schedule: [ | |
// Switch to Calender at 5PM EVERY DAY | |
{ notification: 'PAGE_CHANGED', schedule: '0 17 * * *', payload: 0 }, | |
// Switch to Picture page at 9:30am every day | |
{ notification: 'PAGE_CHANGED', schedule: '30 9 * * 1-5', payload: 1 }, | |
// RESTART THE MAGICMIRROR PROCESS AT 2am EVERY SUNDAY | |
{ notification: 'REMOTE_ACTION', schedule: '0 2 * * SUN', payload: { action: "RESTART" } } | |
] | |
} | |
}, | |
{ | |
module: 'MMM-WebHookAlerts', | |
config: { | |
sound: "woop-woop.wav", | |
fadeSpeed: 30, | |
displaySeconds: 30, | |
effect: "slide", | |
display_time: "90000", | |
position: "center", | |
templates: | |
[ | |
{ | |
templateName: "HealthCheck", | |
title: "{{title}}", | |
template: "{{text}}", | |
sound: "wobble.wav" | |
}, | |
{ | |
templateName: "PLEX", | |
title: "Plex", | |
sound: "woop-woop.wav", | |
template: "{{message.text}}" | |
}, | |
{ | |
templateName: "DevOps", | |
displaySeconds: 120, | |
sound: "twip.wav", | |
title: "{{{resource.definition.name}}}", | |
template: "{{&message.text}}", | |
onlyShowFirstLine: true, | |
}, | |
{ | |
templateName: "SimpleAlert", | |
title: "Delivery", | |
template: "{{message}}", | |
displaySeconds: 5000, | |
fadeSpeed: 10 | |
}, | |
] | |
} | |
}, | |
{ | |
module: 'MMM-Sounds', | |
config: { | |
startupSound: 'woop-woop.wav', | |
quietTimeStart: '20:00', | |
quietTimeEnd: '07:00' | |
} | |
}, | |
{ | |
module: 'MMM-PlexSlideshow', | |
position: 'fullscreen_below', | |
classes: 'daytime_scheduler', | |
config: { | |
plex: { | |
// hostname: "192.168.0.12", | |
// port: 32400, | |
// https: false, | |
hostname: "plex.tewky.pw", | |
port: 443, | |
https: true, | |
authToken: 'BQGrsjsqwCVreoAHrrs8', | |
}, | |
transitionImages: true, | |
randomizeImageOrder: true, | |
}, | |
}, | |
{ | |
module: "MMM-PlexNowPlaying", | |
position: "top_right", | |
header: "Plex: Now Playing", | |
classes: 'daytime_scheduler', | |
config: { | |
serverProtocol: "https", | |
serverAddress: "plex.tewky.pw", | |
serverPort: 443, | |
xPlexToken: "BQGrsjsqwCVreoAHrrs8", // MediaPI Plex | |
showPoster: false, | |
showUser: false, | |
updateInterval: 10, | |
hideWhenNothingPlaying: true, | |
} | |
}, | |
] | |
}; | |
/*************** DO NOT EDIT THE LINE BELOW ***************/ | |
if (typeof module !== "undefined") { module.exports = config; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************************************** | |
* Magic Mirror * | |
* Custom CSS * | |
* * | |
* By Michael Teeuw michaelteeuw.nl * | |
* MIT Licensed. * | |
* * | |
* Add any custom CSS below. * | |
* Changes to this files will be ignored by GIT. * | |
*****************************************************/ | |
html { | |
cursor: pointer; | |
} | |
body { | |
margin: 30px; | |
position: absolute; | |
height: calc(100% - 60px); | |
width: calc(100% - 60px); | |
background: #000; | |
color: #aaa; | |
font-family: "Roboto Condensed", sans-serif; | |
font-weight: 400; | |
font-size: 2em; | |
line-height: 1.5em; | |
-webkit-font-smoothing: antialiased; | |
} | |
.region.fullscreen { | |
position: absolute; | |
top: -30px; | |
left: -30px; | |
right: -30px; | |
bottom: -30px; | |
pointer-events: none; | |
} | |
.region.top.right, | |
.region.top.left, | |
.region.top.center { | |
top: 100%; | |
max-width: 66%!important; | |
} | |
.region.bottom.right, | |
.region.bottom.center, | |
.region.bottom.left { | |
bottom: 100%; | |
max-width: 66%!important; | |
} | |
.leftwide | |
{ | |
width:66% | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Magic Mirror (NodeJS app) | |
After=network.target | |
[Service] | |
Type=simple | |
User=root | |
ExecStart=/usr/bin/node /home/pi/MagicMirror/serveronly/index.js | |
Restart=on-failure | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment