Send notifications to Google Home.
- Run a notification listener server
- Notify next schedule on Google Calendars (Support multi accounts)
- Fetch schedules from Google Calendars (Support multi accounts)
$ notify notify --locale en --message "Sample notification"
$ notify server --port 8000
You can send notification to Google Home devices by curl -X POST -d "Sample Message" localhost:8000
.
Daemon mode provides following feature:
- Run a notification listener server
- Notify next schedule on Google Calendars (Support multi accounts)
You can run daemon after regists google accounts:
notify daemon
- Go to this page and click
Enable the Google Calendar API
Configure your OAuth client
>Desktop app
>CREATE
- Download a client configuration file to same directory as
credentials.json
.
- Run
notify calendar add-token
then show OAuth URL. - Go to the link and authorize.
- Copy a authorization code from an URL parameter:
http://localhost/?state=state-token&code=<authz-code-is-here>&scope=https://www.googleapis.com/auth/calendar.readonly
- Input authorization code to terminal.
- Create or modify
tokens.json
$ chmod +x notify
$ mv notify /usr/local/sbin/google-home-notifier
$ mkdir /etc/google-home-notifier
$ mv google-credentialfile.json /etc/google-home-notifier/credentials.json
$ google-home-notifier calendar add-token --path /etc/google-home-notifier/
$ mv /path/to/google-home-notifier.service /usr/lib/systemd/system/google-home-notifier.service
# Regist new service to systemd
$ systemctl start google-home-notifier.service
# Check systemd status
$ systemctl status google-home-notifier.service
● google-home-notifier.service - Send notifications to Google Home
Loaded: loaded (/lib/systemd/system/google-home-notifier.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2023-01-20 13:54:28 JST; 13s ago
Main PID: 9005 (google-home-not)
Tasks: 10 (limit: 4915)
CGroup: /system.slice/google-home-notifier.service
└─9005 /usr/local/sbin/google-home-notifier daemon --path /etc/google-home-notifier/ --locale ja
Jan 20 13:54:28 tomoya-rasp systemd[1]: Started Send notifications to Google Home.
Jan 20 13:54:28 tomoya-rasp google-home-notifier[9005]: 2023/01/20 13:54:28 commands.go:58: Start daemon.
Jan 20 13:54:28 tomoya-rasp google-home-notifier[9005]: 2023/01/20 13:54:28 server.go:42: server start on port: 8000
# Autostart
$ systemctl enable google-home-notifier.service
Created symlink /etc/systemd/system/multi-user.target.wants/google-home-notifier.service → /lib/systemd/system/google-home-notifier.service.