ラズパイ3 Node-RED セットアップ

ラズパイ3 Node-RED セットアップ

Raspberry PiにおけるNode-REDの活用について

AmazonEcho (Alexa) と RaspberryPi を連携して声だけでPS4を操作する

Amazon EchoをRaspberry Piのワイヤレス音声認識マイク&スピーカとしてミクさんの声で喋らせたり家電制御(リモコン制御)する方法

を参考に
Node-RED を導入

wget https://git.io/noderedlinux

でインストールスクリプトダウンロード

bash noderedlinux

を実行

This script will remove versions of Node.js prior to version 7.x, and Node-RED and
if necessary replace them with Node.js 12.x LTS (erbium) and the latest Node-RED from Npm.
 
It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.
 
It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.
 
To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.
 
Are you really sure you want to do this ? [y/N] ? 

となるので
y で Enter

Would you like to install the Pi-specific nodes ? [y/N] ? 


y で Enter

なお N にすると
標準的な Node-RED となる
もし N にしても再度

bash noderedlinux

を実行すれば選択できる

次に Node-RED の起動

node-red-start 

これで
/home/pi/.node-red/
配下に各種設定ファイルが導入される

Node-RED の停止は
Ctrl + c でログ出力を止めて

node-red-stop 

で停止

ログの確認は

node-red-log

でできる

ログは tail形式で最新のログを順次表示するので
ctrl +c で停止できる

なお自動起動には
systemd スクリプトで設定をする

sudo systemctl enable nodered.service

で自動起動

自動起動解除は

sudo systemctl disable nodered.service

自動起動状態の確認は

sudo systemctl status nodered.service

なおNode-REDの設定を変更した場合

node-red-restart

で再起動する必要がある

次にFlow Editor のログインの画面の設定

Raspberry Pi上のNode-REDにパスワードを設定するスクリプト

を参考に

wget https://git.io/nrpiadminpass.sh

でスクリプト取得

bash nrpiadminpass.sh 任意のパスワード

でパスワードを設定

その後

node-red-restart 

で設定を反映

これで
Ubuntu で
Firefox や Chrome などで
http://raspberrypi.local:1880/
へアクセスすると
ログイン画面になるので
ユーザ名 admin
パスワードは設定したパスワード
でログインできるようになる

次に FlowEditor のURL変更

vim .node-red/settings.js

で設定を開き
94行目の

 //httpAdminRoot: '/admin',

 httpAdminRoot: '/admin',

というようにコメントアウトを削除

その後

node-red-restart 

で設定を反映

これで
http://raspberrypi.local:1880/admin/
へアクセスすると
ログイン画面になる

これで Node-RED のセットはできたので
次回は Node-RED Alexa Home Skill Bridge の設定

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です