Git Product home page Git Product logo

hakoirimusume's Introduction

箱入り娘 —— ペットを見守るLINE BOT

LINEのトークからいつでもペットの様子と部屋の気温がわかります

  • Raspberry Piに接続したカメラの映像と室温・湿度・気圧センサーからの情報をLINE Messaging APIを通していつでも問い合わせることが出来ます。
  • 家族以外がBOTを友達追加しても機能にアクセスできないように、合言葉による認証機能を備えています。
  • Docker Containerを利用して簡単に環境を構築することも可能です。

使い方

箱入り娘を使い始めるには、以下の2つの方法があります。

  1. 最新のリリースからダウンロードしてインストールする方法
  2. リポジトリをクローンしてビルドする方法

1. 最新のリリースからダウンロードしてインストールする方法

  1. 最新のリリースからhakoirimusume-vX.X.X.zipをダウンロードします。
  2. ダウンロードしたZIPファイルをインストールしたいディレクトリに展開します。
  3. 箱入り娘LINEボットサーバーと、センサーサーバーの設定を確認し、必要に応じて設定を変更します。 (詳細は箱入り娘の設定についてを参照)
  4. 展開したフォルダ内のsetup.shを実行して、インストールと初回の設定を行います。
  5. インストールが完了したら、sudo systemctl start hakoirimusume.service hakoirimusume-sensor.serviceを実行するか、 サーバーを再起動して箱入り娘のサービスを起動します。

2. リポジトリをクローンしてビルドする方法

  1. リポジトリをクローンします。
    git clone https://github.com/kei-mag/Hakoirimusume.git
  2. Spring Bootアプリケーションをビルドします。
    cd Hakoirimusume
    ./gradlew build
  3. sampleディレクトリ内のServiceファイルを参考に、箱入り娘LINEボットサーバーとセンサーサーバーの起動構成を記述します。
  4. サービスファイルを/etc/systemd/system/に配置し、sudo systemctl enable hakoirimusume.service hakoirimusume-sensor.serviceを実行してサービスを有効化します。
  5. sudo systemctl start hakoirimusume.service hakoirimusume-sensor.serviceを実行するか、サーバーを再起動して箱入り娘のサービスを起動します。

動作テスト環境

  • Raspberry Pi 4 Model B Rev 1.4 (8GB RAM) , Raspberry Pi Zero WH
  • Raspberry Pi Camera Module 2
  • Raspberry Pi OS
    • Release date: March 15th 2024
    • System: 32-bit, 64-bit
    • Kernel version: 6.6
    • Debian version: 12 (bookworm)
    • Default Python: Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
  • JAVA 17.0.1
    $ java --version
    openjdk 17.0.11 2024-04-16
    OpenJDK Runtime Environment (build 17.0.11+9-Raspbian-1deb12u1rpt1)
    OpenJDK Client VM (build 17.0.11+9-Raspbian-1deb12u1rpt1, mixed mode, emulated-client)

ディレクトリ構成

Hakoirimusume
├─docs                            # ドキュメント
├─gradle                          # Gradle関連ファイル
│  └─wrapper
├─sample                          # サンプルファイル
├─sensor_server                   # 箱入り娘センサーサーバー
│  └─templates                    # センサーサーバーのHTMLテンプレート
├─src                             # 箱入り娘LINEボットサーバー
│  ├─main
│  │  ├─java
│  │  │  └─net
│  │  │      └─keimag
│  │  │          └─hakoirimusume  # メインファイル
│  │  └─resources
│  │      ├─static
│  │      └─templates
│  └─test
│      └─java
│          └─net
│              └─keimag
│                  └─hakoirimusume  # テストファイル
└─tools                             # ツールスクリプト

ライセンス

このプロジェクトは、MITライセンスの下で公開されています。

hakoirimusume's People

Contributors

kei-mag avatar

Watchers

 avatar

hakoirimusume's Issues

Implement SQLite support

Functions

  • addUser(userId, authorityLevel) → result
  • setState(userId, newState) → result
  • resetState()

Database Design

UserData

UserID AuthorityLevel State LatestRequestTime
LINE UserID 0(noUser), 1(normalUser), 2(adminUser) int? DateTime, null
  • db connection is opend when each request is processed, and closed when system finished processing database for each request.
  • State is set to 0 when system is launched.

Implement User Authentication with Aikotoba

Functions

  • createNewAikotoba(issuerUserId) -> newAikotobaString || false (busy)
  • authenticate(aikotoba) -> isSuccussed
  • invalidateAikotoba()

Data

  • aikotobaString (String || null)
  • expirationTime (DateTime || null)
  • issuerUserId (String || null)

Process of authentication

A: user, B: new comer

  1. A request to create new aikotoba.
  2. A got new aikotoba.
  3. A tell aikotoba string to B.
  4. B requests authentication
  5. System replies "Start authentication. Please send me aikotoba".
    (And adds B to UserData database for state management)
  6. B send aikotoba string.
    If B send correct aikotoba
  7. B is added to user list. [END]
    If B send wrong aikotoba
  8. System replies "Your aikotoba is not correct. Please ask user to recreate aikotoba."
  9. System variable aikotobaString is set to null.
  10. If B resend the same wrong aikotoba.
  11. System replies "Your aikotoba is not correct. Please ask user to recreate aikotoba."
    (when aikotobaString==null, system always replies 'not correct.')
  12. Back to step 1.

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.