A tool created to receive Gmail with Raspberry Pi 3 using golang Gmail SDK.
I made it for Raspberry Pi 3 to work.
Check Gmail using golang Gmail SDK and execute the specified command when there is a mail that meets the conditions.
Speech synthesis(text-to-speech) and USB power management commands must be installed in Raspberry Pi 3 beforehand as specified commands.
Click on the image to watch the movie!
- It is made by golang so it supports multi form.
- If you get Gamil certification and describe the setting in the setting file, it works.
- Go 1.9+
- Speech synthesis(text-to-speech) tool
- AquesTalk Pi - Raspberry Pi用の音声合成
- USB power management tool
- codazoda/hub-ctrl.c: Control USB power on a port by port basis on some USB hubs.
- Gamil certification
- Go Quickstart | Gmail API | Google Developers
Just run the only one command.
$ ./ggm
However, setting is necessary to execute.
-
In the same place as the binary file create
.ggm
dir. -
Get Gamil certification.
- Go Quickstart | Gmail API | Google Developers
-
Save Gamil certification
.ggm/client_secret.json
{
"installed": {
"client_id": "123456789012-abcdefghijklnmopqrstuvwxyz123456.apps.googleusercontent.com",
"project_id": "ex-gmail-test",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "AbCdEfGhijklNmopqr135790",
"redirect_uris": [
"urn:ietf:wg:oauth:2.0:oob",
"http://localhost"
]
}
}
- Run command
./ggm
- Copy the URL displayed on the terminal and access it with the browser.
- Perform an authorization operation in the browser, display the code, and input it to the terminal.
.ggm/client_token.json
file is created.
{
"access_token": "1234.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"token_type": "Bearer",
"refresh_token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"expiry": "2017-09-04T20:25:28.251300122+09:00"
}
- Execution settings are done with
.ggm/user_config.json
file.
{
"LastDate": 1504243346130,
"LastTotal": 749,
"UserEmail": "[email protected]",
"SpeakCommands": [["/home/pi/aquestalkpi/AquesTalkPi", "-s", "120", "%s"],["aplay"]],
"UsbCommands": [["sudo", "hub-ctrl", "-h", "0", "-P", "2", "-p", "%d"]],
"Filters": [
{
"From": "[email protected]",
"Subjects": ["test","user1"]
},
{
"From": "[email protected]",
"Subjects": null
}
]
}
$ go get github.com/uchimanajet7/ggm
- Raspberry Pi 3+Gmail APIでメールを受信して音声合成してみた #raspberrypi #gmail #golang - uchimanajet7のメモ