Code Monkey home page Code Monkey logo

pi-alarm's Introduction

Pi-Alarm

A tiny & cool application for Raspberry Pi 3 to alarm by playing music. Pi-Alarm is controlled by Hi-Morning (a mobile app) that uses google firebase to sync scheduler alarms between Pi & mobile. Hi-Morning is contributed by @thoqbk

Special thanks to @nghnam https://github.com/nghnam/music-aekt for supporting a nice and concise Python Mocp Wrapper Utils, which uses to play music in Linux Terminal Command Line.

Requirements & Setup.

Hardware

Pi - 3 with Wi-Fi & Audio support

Setup Environment ( Ubuntu )

sudo pip install Flask
sudo pip install requests
sudo pip install python-firebase
sudo pip install apscheduler
sudo apt-get install moc

Integrate with Hi-Morning

  • You can use Hi-Morning as a mobile controller app. Let's follow introduction of @thoqbk

  • Pi-Alarm can run standalone as well through browser.

Update Pi-Alarm configuration

$ nano config.py
# flask server
DEBUG = True
HOST = "0.0.0.0"
PORT = 8080

# music folder
MUSIC_FOLDER = 'musics'

# running mode
## Note : unsupport Standalone mode yet !
STANDALONE = False

# firebase authentication
FIREBASE_URI = "https://pi-alrm.firebaseio.com"
FIREBASE_AUTH_USERNAME = "pi-alarm"
FIREBASE_AUTH_PASSWORD = "pi-alarm"
.....

You can define your own firebase database with the following structure

{
  "users": {
    "pi-alarm": {
      "alarms": [
        {
          "name": "coffee",
          "status": "on",
          "time": "22:51:50"
        },
        {
          "name": "running",
          "status": "on",
          "time": "05:00:00"
        },
        {
          "name": "check mail",
          "status": "off",
          "time": "09:00:00"
        }
      ],
      "name": "Pi-Alarm"
    }
  }
}    

Upload music

  • Download mp3 files to Pi and and put them into MUSIC_FOLDER

Run

$ python app.py

Open browser and go to: http://your_pi_ip:8080

Deploy with Gunicorn HTTP Server

Reference

  1. http://apscheduler.readthedocs.io/en/3.0/userguide.html
  2. https://moc.daper.net/

pi-alarm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vman45

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.