Pull recent commits #1

Merged
mgfcf merged 39 commits from master into master 2019-02-19 20:36:07 +01:00
11 changed files with 288 additions and 315 deletions

View file

@ -79,7 +79,6 @@ def main():
if (week_starts_on == "Sunday"): if (week_starts_on == "Sunday"):
calendar.setfirstweekday(calendar.SUNDAY) calendar.setfirstweekday(calendar.SUNDAY)
draw(weekplace, weeksun)
image.paste(weeksun, weekplace) image.paste(weeksun, weekplace)
draw(weekdayssun[(time.strftime("%a"))], weekday) draw(weekdayssun[(time.strftime("%a"))], weekday)
@ -191,31 +190,45 @@ def main():
print('Fetching events from your calendar'+'\n') print('Fetching events from your calendar'+'\n')
events_this_month = [] events_this_month = []
upcoming = [] upcoming = []
for icalendars in ical_urls: for icalendars in ical_urls:
ical = Calendar(urlopen(icalendars).read().decode()) decode = str(urlopen(icalendars).read().decode())
#fix a bug related to Alarm action by replacing parts of the icalendar
fix_e = decode.replace('BEGIN:VALARM\r\nACTION:NONE','BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:')
#uncomment line below to display your calendar in ical format
#print(fix_e)
ical = Calendar(fix_e)
for events in ical.events: for events in ical.events:
if time.now().strftime('%-m %Y') == (events.begin).format('M YYYY'): if time.now().strftime('%-m %Y') == (events.begin).format('M YYYY') and (events.begin).format('DD') >= time.now().strftime('%d'):
upcoming.append({'date':events.begin.format('D MMM'), 'event':events.name}) upcoming.append({'date':events.begin.format('DD MMM'), 'event':events.name})
events_this_month.append(int((events.begin).format('D'))) events_this_month.append(int((events.begin).format('D')))
if month == 12: if month == 12:
if (1, year+1) == (1, int((events.begin).year)): if (1, year+1) == (1, int((events.begin).year)):
upcoming.append({'date':events.begin.format('D MMM'), 'event':events.name}) upcoming.append({'date':events.begin.format('DD MMM'), 'event':events.name})
if month != 12: if month != 12:
if (month+1, year) == (events.begin).format('M YYYY'): if (month+1, year) == (events.begin).format('M YYYY'):
upcoming.append({'date':events.begin.format('D MMM'), 'event':events.name}) upcoming.append({'date':events.begin.format('DD MMM'), 'event':events.name}) # HS sort events by date
def takeDate(elem):
return elem['date']
upcoming.sort(key=takeDate)
del upcoming[4:] del upcoming[4:]
# uncomment the following 2 lines to display the fetched events
# from your iCalendar
print('Upcoming events:')
print(upcoming)
#Credit to Hubert for suggesting truncating event names
def write_text_left(box_width, box_height, text, tuple): def write_text_left(box_width, box_height, text, tuple):
text_width, text_height = font.getsize(text) text_width, text_height = font.getsize(text)
if (text_width, text_height) > (box_width, box_height): while (text_width, text_height) > (box_width, box_height):
raise ValueError('Sorry, your text is too big for the box') text=text[0:-1]
else: text_width, text_height = font.getsize(text)
y = int((box_height / 2) - (text_height / 2)) y = int((box_height / 2) - (text_height / 2))
space = Image.new('L', (box_width, box_height), color=255) space = Image.new('L', (box_width, box_height), color=255)
ImageDraw.Draw(space).text((0, y), text, fill=0, font=font) ImageDraw.Draw(space).text((0, y), text, fill=0, font=font)
image.paste(space, tuple) image.paste(space, tuple)
"""Write event dates and names on the E-Paper""" """Write event dates and names on the E-Paper"""
for dates in range(len(upcoming)): for dates in range(len(upcoming)):

View file

@ -24,7 +24,7 @@ def calibration():
red = Image.new('L', (EPD_WIDTH, EPD_HEIGHT), 'red') red = Image.new('L', (EPD_WIDTH, EPD_HEIGHT), 'red')
ImageDraw.Draw(red) ImageDraw.Draw(red)
print('calibrating red...') print('calibrating red...')
epd.display_frame(epd.get_frame_buffer(red)) epd.display_frame(epd.get_frame_buffer(red))
white = Image.new('1', (EPD_WIDTH, EPD_HEIGHT), 'white') white = Image.new('1', (EPD_WIDTH, EPD_HEIGHT), 'white')
ImageDraw.Draw(white) ImageDraw.Draw(white)
print('calibrating white...') print('calibrating white...')

View file

@ -1,14 +1,13 @@
""" To quickly get started, fill in the following details:""" """ To quickly get started, fill in the following details:"""
ical_urls = [ ical_urls = [
"https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics", "https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics"
"https://www.schulferien.org/media/ical/deutschland/ferien_baden-wuerttemberg_2019.ics?k=5dMdMMsZXnpA5bg9D0GY246EAIRqWAWv9fRtQ-ekYM1ADwSZeJpvo4fd-NhwlSxOPxm6BQRUgRvcQSKArfGUwZQLDfYfaiWnA1E9diCCB8s"
] ]
api_key = "" #your owm-api-key api_key = ""
location = "Julich, DE" #your location location = "Julich, DE"
week_starts_on = "Monday" #Sunday or Monday week_starts_on = "Monday"
display_colours = "bwr" #bwr=3-colour, bw=2-colour display_colours = "bwr"
language = "de" #en=english, de=german language = "en"
units = "metric" #metric or imperial? units = "metric"
hours = "24" #12 or 24? hours = "24"

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
Gallery/v1.5-bw.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
Gallery/v1.5-bwr.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View file

@ -1,173 +0,0 @@
#!/bin/bash
# E-Paper-Calendar software installer for the raspberry pi
# Version: 1.5 (Early Februrary 2019)
# Well tested and confirmed on 3rd Feb 2019
# Copyright by aceisace
echo -e "\e[1mPlease select an option from below:"
echo -e "\e[97mEnter \e[91m1 \e[97m to install/update the E-Paper software"
echo -e "\e[97mEnter \e[91m2 \e[97m to uninstall the E-Paper software"
echo -e "\e[1mNote: Updating will back up just the settings.py file."
echo -e "\e[97mConfirm your selection with [ENTER]"
read -r -p 'Waiting for input... ' option
if [ "$option" != 1 ] && [ "$option" != 2 ]; then
echo "invalid number, aborting now"
exit
fi
if [ -z "$option" ]; then
echo "You didn't enter anything, aborting now."
exit
fi
if [ "$option" = 2 ]; then
echo "Removing the E-Paper software now..."
pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove --purge supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y && sudo rm -r /home/pi/E-Paper-Master/
fi
if [ "$option" = 1 ]; then
echo "Checking if the software is installed"
if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]
then
echo "Found an E-Paper settings file."
sleep 2
echo "Backing up the current settings file in the home directory."
sleep 2
cp /home/pi/E-Paper-Master/Calendar/settings.py /home/pi/settings-old.py
echo "renaming the old E-Paper software folder"
sleep 2
cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old
echo "Updating now..."
# Getting input to see which E-Paper version is currently being used.
fi
echo -e "\e[1mWhich version of the E-Paper display are you using?"
echo -e "\e[97mEnter \e[91m2 \e[97m if you are using the 2-Colour E-Paper"
echo -e "\e[97mEnter \e[91m3 \e[97m if you are using the 3-Colour E-Paper"
echo -e "\e[97mconfirm your selection with [ENTER]"
read -r -p 'Please type in the number now: ' digit
if [ -z "$digit" ]; then
echo "You didn't enter anything."
echo "Aborting now."
exit
fi
if [ "$digit" != 2 ] && [ "$digit" != 3 ]; then
echo "invalid number, only 2 or 3 can be accepted."
echo "Aborting now."
exit
fi
if [ "$digit" = 2 ] || [ "$digit" = 3 ]; then
echo ""
echo -e "\e[1;36m"Your input was accepted"\e[0m"
echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m"
echo ""
fi
# Updating and upgrading the system, without taking too much space
echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m"
echo -e "\e[1;36m"This will take a while, sometimes up to 30 mins"\e[0m"
sudo apt-get update && sudo apt-get dist-upgrade -y
echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m"
echo ""
# Installing a few packages which are missing on Raspbian Stretch Lite
echo -e "\e[1;36m"Installing a few packages that are missing on Raspbian Stretch Lite..."\e[0m"
sudo apt-get install python3-pip python-rpi.gpio-dbgsym python3-rpi.gpio python-rpi.gpio python3-rpi.gpio-dbgsym python3-spidev git libopenjp2-7-dev libtiff5 -y
pip3 install Pillow==5.3.0
sudo pip3 install Pillow==5.3.0
echo ""
fin
# Running apt-get clean and apt-get autoremove
echo -e "\e[1;36m"Cleaning a bit of mess to free up some space..."\e[0m"
sudo apt-get clean && sudo apt-get autoremove -y
echo ""
# Installing packages required by the main script
echo -e "\e[1;36m"Installing a few required packages for the E-Paper Software"\e[0m"
sudo pip3 install pyowm
sudo pip3 install ics
pip3 install pyowm
pip3 install ics
echo ""
echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m"
cd
git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather
mkdir E-Paper-Master
cd E-Paper-Calendar-with-iCal-sync-and-live-weather
cp -r Calendar /home/pi/E-Paper-Master/
cp README.md /home/pi/E-Paper-Master/
cp LICENSE /home/pi/E-Paper-Master/
cp -r .git /home/pi/E-Paper-Master/
cd
sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather
# Using this part for the 2-colour E-Paper version
if [ "$digit" = 2 ]; then
# edit the settings file for the 2-colour display option
sed -i 's/display_colours = "bwr"/display_colours = "bw"/' /home/pi/E-Paper-Master/Calendar/settings.py
# add a short info
cat > /home/pi/E-Paper-Master/Info.txt << EOF
This document contains a short info of the E-Paper-Calendar software version
Version: 2-Colour E-Paper-version
Installer version: 1.5 (Early February 2019)
configuration file: /home/pi/E-Paper-Master/Calendar/settings.py
If the time was set correctly, you installed this software on:
EOF
echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt
echo ""
fi
# Using this part for the 3-colour E-Paper version
if [ "$digit" = 3 ]; then
# add a short info
cat > /home/pi/E-Paper-Master/Info.txt << EOF
This document contains a short info of the version
Version: 3-Colour E-Paper-version
Installer version: 1.5 (Early February 2019)
configuration file: /home/pi/E-Paper-Master/Calendar/settings.py
If the time was set correctly, you installed this software on:
EOF
echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt
echo ""
fi
# Setting up supervisor
echo -e "\e[1;36m"Setting up the script to start at boot..."\e[0m"
sudo apt-get install supervisor -y
sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF
[program:E-Paper]
command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py
stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log
stdout_logfile_maxbytes = 1MB
stderr_logfile = /home/pi/E-Paper-Master/E-Paper-err.log
stderr_logfile_maxbytes = 1MB
EOF
sudo service supervisor start E-Paper
echo ""
# Final words
echo -e "\e[1;36m"The install was successful"\e[0m"
echo -e "\e[1;36m"The programm will now start at every boot."\e[0m"
echo -e "\e[1;31m"Please enter your details in the file 'settings.py'."\e[0m"
echo -e "\e[1;31m"If this file is not modified, the programm will not start"\e[0m"
echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m"
echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m"
echo ""
echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m"
echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Master/E-Paper.py"\e[0m"
fi

146
Installer-with-debug.sh Normal file
View file

@ -0,0 +1,146 @@
#!/bin/bash
# E-Paper-Calendar software installer for the raspberry pi
# Version: 1.5 (Early Februrary 2019)
# Stability status of this installer: pending
# Copyright by aceisace
echo -e "\e[1mPlease select an option from below:"
echo -e "\e[97mEnter \e[91m1 \e[97m to update the E-Paper software"
echo -e "\e[97mEnter \e[91m2 \e[97m to install the E-Paper software"
echo -e "\e[97mEnter \e[91m3 \e[97m to uninstall the E-Paper software"
echo -e "\e[97mConfirm your selection with [ENTER]"
read -r -p 'Waiting for input... ' option
if [ "$option" != 1 ] && [ "$option" != 2 ] && [ "$option" != 3 ]; then
echo -e "invalid number, aborting now"
exit
fi
if [ -z "$option" ]; then
echo -e "You didn't enter anything, aborting now."
exit
fi
if [ "$option" = 3 ]; then
echo -e "Removing the E-Paper software now..."
pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y
if [ -e /etc/supervisor/conf.d/E-Paper.conf ]; then
sudo rm /etc/supervisor/conf.d/E-Paper.conf
fi
echo -e "The libraries have been removed successfully"
echo -e "Removing the E-Paper-Calendar folder if it exists"
if [ -d "/home/pi/E-Paper-Master" ]; then
sudo rm -r /home/pi/E-Paper-Master/
fi
fi
if [ "$option" = 1 ]; then
echo "Checking if the settings.py exists..."
if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]; then
echo -e "Found an E-Paper settings file."
sleep 2
echo "Backing up the current settings file in the home directory."
sleep 2
cp /home/pi/E-Paper-Master/Calendar/settings.py /home/pi/settings-old.py
echo -e "renaming the old E-Paper software folder"
sleep 2
cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old
sudo rm -r /home/pi/E-Paper-Master
echo "Updating now..."
echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m"
cd
else
echo -e "Could not find any settings.py file in /home/pi/E-Paper-Master"
echo -e "Please uninstall the software first and then use the install option"
echo -e "Exiting now"
exit
fi
fi
if [ "$option" = 2 ]; then
echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m"
# Updating and upgrading the system, without taking too much space
echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m"
echo -e "\e[1;36m"This will take a while, sometimes up to 30 mins"\e[0m"
sudo apt-get update && sudo apt-get dist-upgrade -y
echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m"
echo ""
# Installing a few packages which are missing on Raspbian Stretch Lite
echo -e "\e[1;36m"Installing a few packages that are missing on Raspbian Stretch Lite..."\e[0m"
sudo apt-get install python3-pip python-rpi.gpio-dbgsym python3-rpi.gpio python-rpi.gpio python3-rpi.gpio-dbgsym python3-spidev git libopenjp2-7-dev libtiff5 -y
pip3 install Pillow==5.3.0
sudo pip3 install Pillow==5.3.0
echo ""
# Running apt-get clean and apt-get autoremove
echo -e "\e[1;36m"Cleaning a bit of mess to free up some space..."\e[0m"
sudo apt-get clean && sudo apt-get autoremove -y
echo ""
# Installing packages required by the main script
echo -e "\e[1;36m"Installing a few required packages for the E-Paper Software"\e[0m"
sudo pip3 install pyowm
sudo pip3 install ics
pip3 install pyowm
pip3 install ics
echo -e "\e[1;36m"Finished installing libraries"\e[0m"
fi
if [ "$option" = 1 ] || [ "$option" = 2 ]; then
echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m"
cd
git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather
mkdir E-Paper-Master
cd E-Paper-Calendar-with-iCal-sync-and-live-weather
cp -r Calendar /home/pi/E-Paper-Master/
cp README.md /home/pi/E-Paper-Master/
cp LICENSE /home/pi/E-Paper-Master/
cp -r .git /home/pi/E-Paper-Master/
# Make a copy of the sample settings.py file
cd /home/pi/E-Paper-Master/Calendar
cp settings.py.sample settings.py
cd
# Remove the downloaded (temporary) directory
sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather
# add a short info
cat > /home/pi/E-Paper-Master/Info.txt << EOF
This document contains a short info of the E-Paper-Calendar software version
Version: 1.5
Installer version: 1.5 (Early February 2019)
configuration file: /home/pi/E-Paper-Master/Calendar/settings.py
If the time was set correctly, you installed this software on:
EOF
echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt
echo ""
# Setting up supervisor
echo -e "\e[1;36m"Setting up auto-start of script at boot"\e[0m"
sudo apt-get install supervisor -y
sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF
[program:E-Paper]
command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py
stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log
stdout_logfile_maxbytes = 1MB
stderr_logfile = /home/pi/E-Paper-Master/E-Paper-err.log
stderr_logfile_maxbytes = 1MB
EOF
sudo service supervisor start E-Paper
echo ""
# Final words
echo -e "\e[1;36m"The install was successful"\e[0m"
echo -e "\e[1;36m"The programm is set to start at every boot."\e[0m"
echo -e "\e[1;31m"Please enter your details in the file 'settings.py'."\e[0m"
echo -e "\e[1;31m"If this file is not modified, the programm will not start"\e[0m"
echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m"
echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m"
echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m"
echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py"\e[0m"
fi

View file

@ -1,25 +1,34 @@
### This file contains features in planning for the next release ### This file contains features in planning for the next release
# For version 1.5 # For version 1.6
## Installer ## Installer
* Update installer with options to update, install and uninstall the entire software (including backing up of the settings.py file) * Optimise the installer by adding a few more options when updating
* Remove Installer without debug (is there really a neeed to?)
## Main script ## Main script
* Optimise icons and their positions to create more space and improve readability * Implement weekly view (may take a lot of time)
* Add support for jpeg files! (BMP files will no longer be used) * Display more events when free space is available (below monthly calendar)
* Add feature to display upcoming events * Implement feature to fetch tasks
* Replace 'current day' and 'event' icons with better ones * Add code in E-Paper.py for fixing errors related to the iCalendar (ics.py is pretty picky)
* Add support for units (metric/imperial) * Truncate event names if they're too long to be displayed
* Add 12/24 hour support * Fix a bug where past events are shown along with ones in the future
* Add support for ics files along with iCalendar URLs
* Allow connecting to the openweathermap API servers even when the SSL certificate has expired
* Try using the weathericons.io font instead of icons
## E-Paper files (epd7in5/epd7in5b)
* Optimise values for displaying images by modifying some values
when converting image to data
* Merge calibration module with epd7in5 and epd7in5b
* Create function to calibrate the screen much faster by omitting conversion
## Settings file ## Settings file
* Add option for choosing metric or imperial units * Add option to switch between the monthly and weekly view
* Add option for choosing 12/24 hours format * Add option to display tasks instead of/and events
--------------------------- ---------------------------
## More feature suggestions (will not be implemented anytime soon) ## More feature suggestions (will not be implemented anytime soon)
* Nextcloud Integration (further research required) * Nextcloud Integration (further research required)
* Displaying tasks from iCalendar (further research required)
* Add an option in the settings file to switch between weekly and monthly view
If you can help with any features, please do so :)

View file

@ -7,14 +7,14 @@ This software fully supports the 3-Colour **and** 2-Colour version of the 7.5" E
**To get started, follow the instructions below.** **To get started, follow the instructions below.**
## News: ## News:
* **Version 1.5 released (Early February 2019) with new features and lots of back-end improvements** * **Version 1.5 released (Early February 2019) with a new layout, displayed events and many back-end improvements**
* **Version 1.4 released (Late December 2018) with new features and more improvements** * **Added Support for the 2-Colour E-Paper Display as well!** (Late September 2018)
* **Version 1.3 released (Mid October 2018) for better user expierence** * **Added Support for Raspbian Stretch lite.** (Late September 2018)
* **Added Support for the 2-Colour E-Paper Display as well!** (End of September)
* **Added Support for Raspbian Stretch lite.** (End of September)
Image shows v1.4, the latest version is v1.5. An updated image will be added soon. <img src="https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/blob/master/Gallery/v1.5-bwr.JPG" width="400"><img src="https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/blob/master/Gallery/v1.5-bw.JPG" width="400">
<img src="https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/blob/master/Gallery/7.5inch-E-Paper-software-v1.4.gif" width="500">
Left: Black, White and Red version
Right: Black and White version
## Main features ## Main features
* Display the date and a full monthly calendar * Display the date and a full monthly calendar
@ -46,7 +46,7 @@ Image shows v1.4, the latest version is v1.5. An updated image will be added soo
## Installing required packages for python 3.5 ## Installing required packages for python 3.5
Execute the following command in the Terminal to install all required packages. This will work on both, Raspbian Stretch with Desktop and Raspbian Stretch lite. Execute the following command in the Terminal to install all required packages. This will work on both, Raspbian Stretch with Desktop and Raspbian Stretch lite.
**`bash -c "$(curl -sL https://raw.githubusercontent.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/master/Installer-with-debug)"`** **`bash -c "$(curl -sL https://raw.githubusercontent.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/master/Installer-with-debug.sh)"`**
If the Installer should fail for any reason, kindly open an issue and paste the error. Thanks. If the Installer should fail for any reason, kindly open an issue and paste the error. Thanks.
@ -55,25 +55,33 @@ This is how the installer will run:
<img src="https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/blob/master/Gallery/Installer-v1.2-screenshot.png" width="700"> <img src="https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/blob/master/Gallery/Installer-v1.2-screenshot.png" width="700">
## Adding details to the programm ## Adding details to the programm
Once the packages are installed, navigate to the home directory, open 'E-Paper-Master' and open the file 'settings.py' inside the Calendar folder. Once the packages are installed, navigate to the home directory, open 'E-Paper-Master' and open the file 'settings.py' inside the Calendar folder. Adjust the values as needed. You can use the table below as a reference.
3 Main Details are needed to get running: | Parameter | Description |
1. A valid ical URL. Use the export funtion in google calendar to create a ical url link and paste it in the url section | --- | --- |
2. A valid openweathermap API-Key is required. This key can be optained for free with an account on openweathermap | ical_urls | Your iCalendar URL/s. To add more than one URL, seperate each with a comma |
3. Your city's name and your country code (so the correct weather can be displayed) (e.g. `New York, US`) | api_key | Your __personal__ openweathermap API-key which you can generate and find in your Account info |
| location | Location refers to the closest weather station from your place. It isn't necessarily the place you live in. To find this location, type your city name in the search box on [openweathermap](https://openweathermap.org/). The output should be in the following format: City Name, Country ISO-Code. Not sure what your ISO code is? Check here: [(find iso-code)](https://countrycode.org/) |
| week_starts_on | When does the work start on your Region? Possible options are `"Monday"` or `"Sunday"`|
| display_colours | This should normally be set by the installer when you choose the type of your display. Options include `"bw"` if you're using the black and white E-Paper or `"bwr"` when you're using the black-white-red or black-white-yellow E-Paper|
| language | Choosing the language allows changing the language of the month and week-icons. Possible options are `"en"` for english and `"de"` for german|
|units| Selecting units allows switching units from km/h (kilometer per hour) and °C (degree Celcius) to mph (miles per hour) and °F (degree Fahrenheit). Possible options are `"metric"` or `"imperial"`|
|hours | Which time format do you prefer? This will change the sunrise and sunset times from 24-hours format to 12-hours format. Possible options are `"24"` for 24-hours and `"12"` for 12-hours.|
## Demo ## iCalendar
Once you have setup everything, the E-Paper Calendar will refresh the screen in the following way: It is a bit tricky to set up the iCalendar so it works correctly without throwing any errors. If you encounter errors related to your iCalendar, please open up an issue and paste the error message there.
<img src="https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather/blob/master/Gallery/E-Paper-v1.4-front.JPG" width="500">
A more detailed section about the iCalendar will be added to the wiki soon, but for now, here are some suggestions to prevent error messages:
1) Ensure your iCalendar URL is fine. If you receive an error showing error 404, it means the URL is wrong.
2) If your existing iCalendar doesn't work at all, export the Calendar as a file, then create a new Calendar and import the file from before.
3) If you receive errors related to 'alarm' or 'trigger', please make sure your iCalendar does not use reminders. The problem is that some actions are not supported by the Raspberry and cause errors. For example, the Rapsberry can't send a mail, make a noise or display a message as soon as an event starts.
## Updating ## Updating
If you were using a previous version and want to update, do the following: If you want to update to the latest version, run the Installer from above again and select the 'update' option.
* Save your personal details from the settings file, located in `/home/pi/E-Paper-Master/Calendar/settings.py` in a different location. Before updating, the Installer checks if the settings file (/home/pi/E-Paper-Master/Calendar/settings.py) exists. This is done to test if a previous version was installed correctly. If the settings file exists, it is copied to the home directory and renamed as 'settings.py.old'. The old software folder 'E-Paper-Master' is renamed to 'E-Paper-Master-old'. Lastly, the latest version of the software is copied to the Raspberry as 'E-Paper-Master'.
For example you can copy the settings.py file which contains your configuration information and settings to the home directory.
* Remove the E-Paper-Master folder from the home directory with `sudo rm -r /home/pi/E-Paper-Master/`
* Re-run the (updated) installer and after the install has finshed, copy the contents of the settings.py file to the new settings.py file, located in /home/pi/E-Paper-Master/Calendar/. After updating, copy the contents from your old settings file to the new one. There are usally more options in the new settings.py file so a 'template' is prepared with each update. This template can be found in /home/pi/E-Paper-Master/Calendar/settings.py.sample.
## Don't forget to check out the Wiki. It contains all the information to understanding and customising the script. ## Don't forget to check out the Wiki. It contains all the information to understanding and customising the script.

View file

@ -2,74 +2,64 @@
#!/bin/bash #!/bin/bash
# E-Paper-Calendar software installer for the raspberry pi # E-Paper-Calendar software installer for the raspberry pi
# Version: 1.5 (Early Februrary 2019) # Version: 1.5 (Early Februrary 2019)
# Well tested and confirmed on 3rd Feb 2019 # Stability status of this installer: pending
# Copyright by aceisace # Copyright by aceisace
echo -e "\e[1mPlease select an option from below:" echo -e "\e[1mPlease select an option from below:"
echo -e "\e[97mEnter \e[91m1 \e[97m to install/update the E-Paper software" echo -e "\e[97mEnter \e[91m1 \e[97m to update the E-Paper software"
echo -e "\e[97mEnter \e[91m2 \e[97m to uninstall the E-Paper software" echo -e "\e[97mEnter \e[91m2 \e[97m to install the E-Paper software"
echo -e "\e[97mEnter \e[91m3 \e[97m to uninstall the E-Paper software"
echo -e "\e[1mNote: Updating will back up just the settings.py file." echo -e "\e[1mNote: Updating will back up just the settings.py file."
echo -e "\e[97mConfirm your selection with [ENTER]" echo -e "\e[97mConfirm your selection with [ENTER]"
read -r -p 'Waiting for input... ' option read -r -p 'Waiting for input... ' option
if [ "$option" != 1 ] && [ "$option" != 2 ]; then if [ "$option" != 1 ] && [ "$option" != 2 ] && [ "$option" != 3 ]; then
echo "invalid number, aborting now" echo -e "invalid number, aborting now"
exit exit
fi fi
if [ -z "$option" ]; then if [ -z "$option" ]; then
echo "You didn't enter anything, aborting now." echo -e "You didn't enter anything, aborting now."
exit exit
fi fi
if [ "$option" = 3 ]; then
echo -e "Removing the E-Paper software now..."
if [ "$option" = 2 ]; then pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y
echo "Removing the E-Paper software now..." if [ -e /etc/supervisor/conf.d/E-Paper.conf ]; then
pip3 uninstall Pillow && sudo pip3 uninstall Pillow && sudo pip3 uninstall pyowm && sudo pip3 uninstall ics && pip3 uninstall pyowm && pip3 uninstall ics && sudo apt-get remove --purge supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y && sudo rm -r /home/pi/E-Paper-Master/ sudo rm /etc/supervisor/conf.d/E-Paper.conf
fi
echo -e "The libraries have been removed successfully"
echo -e "Removing the E-Paper-Calendar folder if it exists"
if [ -d "/home/pi/E-Paper-Master" ]; then
sudo rm -r /home/pi/E-Paper-Master/
fi
fi fi
if [ "$option" = 1 ]; then if [ "$option" = 1 ]; then
echo "Checking if the software is installed" echo "Checking if the settings.py exists..."
if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ] if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]; then
then echo -e "Found an E-Paper settings file."
echo "Found an E-Paper settings file."
sleep 2 sleep 2
echo "Backing up the current settings file in the home directory." echo "Backing up the current settings file in the home directory."
sleep 2 sleep 2
cp /home/pi/E-Paper-Master/Calendar/settings.py /home/pi/settings-old.py cp /home/pi/E-Paper-Master/Calendar/settings.py /home/pi/settings-old.py
echo "renaming the old E-Paper software folder" echo -e "renaming the old E-Paper software folder"
sleep 2 sleep 2
cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old
sudo rm -r /home/pi/E-Paper-Master
echo "Updating now..." echo "Updating now..."
# Getting input to see which E-Paper version is currently being used. echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m"
fi cd
echo -e "\e[1mWhich version of the E-Paper display are you using?" else
echo -e "\e[97mEnter \e[91m2 \e[97m if you are using the 2-Colour E-Paper" echo -e "Could not find any settings.py file in /home/pi/E-Paper-Master"
echo -e "\e[97mEnter \e[91m3 \e[97m if you are using the 3-Colour E-Paper" echo -e "Please uninstall the software first and then use the install option"
echo -e "\e[97mconfirm your selection with [ENTER]" echo -e "Exiting now"
read -r -p 'Please type in the number now: ' digit exit
if [ -z "$digit" ]; then
echo "You didn't enter anything."
echo "Aborting now."
exit
fi
if [ "$digit" != 2 ] && [ "$digit" != 3 ]; then
echo "invalid number, only 2 or 3 can be accepted."
echo "Aborting now."
exit
fi
if [ "$digit" = 2 ] || [ "$digit" = 3 ]; then
echo ""
echo -e "\e[1;36m"Your input was accepted"\e[0m"
echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m"
echo ""
fi fi
fi
if [ "$option" = 2 ]; then
echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m"
# Updating and upgrading the system, without taking too much space # Updating and upgrading the system, without taking too much space
echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m"
echo -e "\e[1;36m"This will take a while, sometimes up to 30 mins"\e[0m" echo -e "\e[1;36m"This will take a while, sometimes up to 30 mins"\e[0m"
@ -83,7 +73,6 @@ if [ "$option" = 1 ]; then
pip3 install Pillow==5.3.0 pip3 install Pillow==5.3.0
sudo pip3 install Pillow==5.3.0 sudo pip3 install Pillow==5.3.0
echo "" echo ""
fin
# Running apt-get clean and apt-get autoremove # Running apt-get clean and apt-get autoremove
echo -e "\e[1;36m"Cleaning a bit of mess to free up some space..."\e[0m" echo -e "\e[1;36m"Cleaning a bit of mess to free up some space..."\e[0m"
@ -96,8 +85,10 @@ fin
sudo pip3 install ics sudo pip3 install ics
pip3 install pyowm pip3 install pyowm
pip3 install ics pip3 install ics
echo "" echo -e "\e[1;36m"Finished installing libraries"\e[0m"
fi
if [ "$option" = 1 ] || [ "$option" = 2 ]; then
echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m"
cd cd
git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather
@ -110,50 +101,29 @@ fin
cd cd
sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather
# Using this part for the 2-colour E-Paper version # add a short info
if [ "$digit" = 2 ]; then cat > /home/pi/E-Paper-Master/Info.txt << EOF
# edit the settings file for the 2-colour display option This document contains a short info of the E-Paper-Calendar software version
sed -i 's/display_colours = "bwr"/display_colours = "bw"/' /home/pi/E-Paper-Master/Calendar/settings.py
# add a short info
cat > /home/pi/E-Paper-Master/Info.txt << EOF
This document contains a short info of the E-Paper-Calendar software version
Version: 2-Colour E-Paper-version Version: 1.5
Installer version: 1.5 (Early February 2019) Installer version: 1.5 (Early February 2019)
configuration file: /home/pi/E-Paper-Master/Calendar/settings.py configuration file: /home/pi/E-Paper-Master/Calendar/settings.py
If the time was set correctly, you installed this software on: If the time was set correctly, you installed this software on:
EOF EOF
echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt
echo "" echo ""
fi
# Using this part for the 3-colour E-Paper version
if [ "$digit" = 3 ]; then
# add a short info
cat > /home/pi/E-Paper-Master/Info.txt << EOF
This document contains a short info of the version
Version: 3-Colour E-Paper-version
Installer version: 1.5 (Early February 2019)
configuration file: /home/pi/E-Paper-Master/Calendar/settings.py
If the time was set correctly, you installed this software on:
EOF
echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt
echo ""
fi
# Setting up supervisor # Setting up supervisor
echo -e "\e[1;36m"Setting up the script to start at boot..."\e[0m" echo -e "\e[1;36m"Setting up auto-start of script at boot"\e[0m"
sudo apt-get install supervisor -y sudo apt-get install supervisor -y
sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF
[program:E-Paper] [program:E-Paper]
command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py
stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log
stdout_logfile_maxbytes = 1MB stdout_logfile_maxbytes = 1MB
stderr_logfile = /home/pi/E-Paper-Master/E-Paper-err.log stderr_logfile = /home/pi/E-Paper-Master/E-Paper-err.log
stderr_logfile_maxbytes = 1MB stderr_logfile_maxbytes = 1MB
EOF EOF
sudo service supervisor start E-Paper sudo service supervisor start E-Paper
@ -168,5 +138,6 @@ EOF
echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m" echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m"
echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m" echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m"
echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m"
echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py"\e[0m"
fi fi