Skip to content

Googleカレンダーから目覚ましをセットするアプリケーション

License

Notifications You must be signed in to change notification settings

Atotti/WakeCalendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wake Calendar

Googleカレンダーから目覚ましをセットするアプリケーションです。 目覚ましをかけ忘れて遅刻したので、作りました。

This is a application that set alarms for you based on google calendar events.

You can set your alarm on google calendar like this:

And you can stop alarm to send get request to {raspberry pi ipadress}:5000/stop. I think add smart phone home is one of good way like this:

How to use

If you use this application, you need to get google service account key file at Google Cloud Console. Don't forget to enable the Google Calendar API to service account. And you need to share your calendar with the service account in google calendar setting.

Please place it in the application directory as credentials.json. And you need to set .env file. This file should contain the following:

CALENDAR_ID=your_calendar_id

Usually, the calendar id is your gmail address. You can find it in the google calendar settings.

WakeCalendar
|   .dockerignore
|   .env
|   .gitignore
|   alarm.py
|   alarm_schedule.json
|   credentials.json
|   Dockerfile
|   main.py
|   README.md
|   requirements.txt
|   setup.py
|   
+---.github
|       dependabot.yml
|       
\---music
        sample.mp3

In this application you can set your own alarm sound file (mp3). You can place it in the music directory. If you don't have any sound file, you can use the default sound file.

Requirements

  • This application is intended to run on a Raspberry Pi with a speaker connected to it.
  • Docker

Build

docker build -t wake-calendar .

Run

docker run -d --rm -p 5000:5000 --device /dev/snd:/dev/snd -v {/path/to/host/directory}/alarm_schedule.json:/app/data/alarm_schedule.json wake-calendar:latest

Auto Restart

I recommend using systemd to auto restart the container in case of a crash. Here is an example service file:

[Unit]
Description=Wake Calendar Docker Container
After=docker.service
Requires=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker run --rm --name wake-calendar -p 5000:5000 --device /dev/snd:/dev/snd -v {/path/to/host/directory}/alarm_schedule.json:/app/data/alarm_schedule.json wake-calendar:latest
ExecStop=/usr/bin/docker stop wake-calendar

[Install]
WantedBy=multi-user.target

Replace {/path/to/host/directory} with the path to the directory you want to use for the data volume. I recommend you to write your repository directory.

Note

sudo systemctl daemon-reload
sudo systemctl enable wake-calendar.service

sudo systemctl start wake-calendar.service

sudo systemctl status wake-calendar.service

About

Googleカレンダーから目覚ましをセットするアプリケーション

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published