MrNegativeTW / JustDrinkIt

Drink reminder, built with Raspberry Pi, Firebase and Android app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Just Drink It

他會提醒你喝水,包含 Server 端和 Android 客戶端原始碼。

PreviewFeaturesRequirementsInstallationLicense

Preview

Features

  • Drink reminder

Requirements

Server

  • Raspberry Pi
  • Fast as fuck internet connection
  • HCSR04
  • HCSR501

Android Client

  • Android Studio 4.1.2+
  • Android 6.0+

Others

  • Firebase Firestore
  • Firebase Cloud Message

Architecture

Installation

Firebase

  1. Create a firebase project

  2. Get your Admin SDK credentials,
    looks like YOUR_PROJECT-firebase-adminsdk-RANDOM_STRING.json

  3. Get your Cloud Mesaage API Key

  4. In Firestore, Create a collection called bottleStatus, than create a document with random id.

  5. Copy that random id.

Android Client

  1. Get your google-services.json from Firebase when adding app, put it in to ./DrinkInClient/app

  2. Modify FirestoreManager.py line 12, replace with your random document id.

return db.collection("bottleStatus").document("RANDOM_ID")
    
  1. Click RUN.

  2. Get your device token by pressing the float action button, which will looks like this:

fWo6-TFJSVCDAV8h8DPRaQ:APA91bELNaBgKduEAWACJN-tIB8CkpDSkbloGIluxaCeMFLDjmpiz26UZqU4L-cW5VeYGK1GiMFywdcaalav8zNWCHurKu10ZnPUlH_w9YYm1WwftXrDv7X58YJNUwtdk60n6ebQWX1r

Server Side

  1. Modify firestore.py line 6, replace with your Admin SDK credentials path.
cred = credentials.Certificate(
    "YOUR_PROJECT-firebase-adminsdk-RANDOM_STRING.json")
  1. Modify fcm.py line 5, replace with your Cloud Mesaage API Key.
api_key = "API_KEY_HERE"
  1. Modify firestore.py line 10, replace with your random document id.
doc_ref = db.collection(u'bottleStatus').document(u'RANDOM_ID')
  1. Modify fcm.py line 8, replace with your android device token.
device_token = "DEVICE_TOKEN_HERE"
  1. Install dependences than start the server.
pip3 install -r requirements.txt
python3 index.txt

Typo

I know. DrinkItClient become DrinkInClient.

License

No idea.

About

Drink reminder, built with Raspberry Pi, Firebase and Android app.


Languages

Language:Kotlin 67.7%Language:Python 32.3%