Skip to content

webdino/enocean-console-demo-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enocean-console-demo-server

https://github.com/epli2/enocean-console-demo 用のサーバです

使用方法

共通

インストール

python3, pip3, mongodbのインストール
sudo apt-get install -y python3 python3-pip mongodb-server
pythonのライブラリをインストール
sudo apt-get install -y python3-pyaudio python3-scipy

pipからpythonライブラリのインストール

sudo pip3 install flask flask_socketio pymongo paho-mqtt gevent-websocket
git clone https://github.com/tsurubee/banpei.git
cd banpei
sudo pip3 install .

https://github.com/tsurubee/banpei のReadmeも参照してください

設定

  • こちらのREADMEを参考に, templates/以下にindex.htmlを, static/以下にjs/css/をコピーしてください config.jsonaudio.INDEXの値を使用するマイクのインデックスに変えてください
    マイクのインデックスの取得方法
> import pyaudio
> p = pyaudio.PyAudio()
> for i in range(p.get_device_count()):p.get_device_info_by_index(i)

Macのみの場合

準備

  1. USBドングルをMacに挿す
  2. webship2017のrepositoryをクローンする
  3. kitchen/mqtt-enocean/のディレクトリでnpm install
  4. kitchen/mqtt-enocean/config/development.jsを編集, USBドングルのデバイスファイルのパスを書き込む
module.exports = {
  portName: "/dev/cu.usbserial-FTSCWGP", // 例
  1. mosquittoをインストールする brew install mosquitto
  2. mosquittoの設定ファイルを記述する vi /usr/local/etc/mosquitto/mosquitto.conf
listener 1883
protocol mqtt

listener 8080
protocol websockets

allow_anonymous true

log_type all
websockets_log_level 1023
connection_messages true
  1. mongodbをインストールする brew install mongodb
    brew services start mongodb

起動

  1. webship2017のkitchen/mqtt-enocean/のディレクトリでnode index.js
  2. mosquitto起動 /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
  3. config.jsonmqtt_servermongoipをどちらもlocalhostにする
  4. このサーバを起動(ポート5000番で起動する) python3 main.py

Raspberry piで動作するmqttブローカーと通信する場合

  1. Raspberry piにmqtt-enoceanとmosquittoをインストールする
  2. USBドングルをRaspberry piに挿す
  3. config.jsonmqtt_server.ipの値をRaspberry piのものにする
  4. 適宜mqtt_server.usernamemqtt_server.passwordを設定する
  5. このサーバを起動(ポート5000番で起動する) python3 main.py
  6. うまく動作しない場合はmqtt_server.headertrueにする

Raspberry piのみの場合

Raspberry piではマイクによる音量の取得は現状動作しない

  1. USBドングルをRaspberry piに挿す
  2. Raspberry piにmqtt-enocean, mosquitto, mongodbをインストールし, 起動する
  3. config.jsonmqtt_servermongoipをどちらもlocalhostにする
  4. このサーバを起動(ポート5000番で起動する) python3 main.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages