1
0
mirror of /repos/dotTiddlywiki.git synced 2025-12-30 07:31:33 +01:00
dotTiddlywiki/mywiki/tiddlers/mosquitto + Node-RED.tid
2015-05-04 16:39:09 +02:00

113 lines
3.0 KiB
Plaintext

created: 20150429212131561
creator: user
modified: 20150504142437959
modifier: user
tags:
title: mosquitto + Node-RED
type: text/vnd.tiddlywiki
* https://github.com/node-red/node-red-nodes/tree/master/io
```bash
su
dpkg-reconfigure tzdata
cd
curl http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key | apt-key add -
cd /etc/apt/sources.list.d/
curl -O http://repo.mosquitto.org/debian/mosquitto-repo.list
cd
apt-get update
apt-get install mosquitto mosquitto-clients
apt-get install build-essential sudo vim-tiny python python-dev python-pip
# python-rpi.gpio
pip install RPi.GPIO
apt-get install libicu-dev libavahi-compat-libdnssd-dev
curl -o /bin/nave https://raw.githubusercontent.com/isaacs/nave/master/nave.sh
chmod +x /bin/nave
useradd -m -s /bin/bash red
# useradd -m -d /data/red -s /bin/bash red
adduser red dialout
adduser red tty
visudo
red ALL=(ALL) NOPASSWD: /usr/bin/python
su red
cd
nave use 0.10.38
npm install -g node-red
npm install -g mongodb
npm install -g redis
npm install -g arduino-firmata
cd .node-red
npm install node-red-contrib-freeboard
npm install node-red-node-discovery
npm install node-red-node-snmp
cd
npm install -g pm2
pm2 start `which node-red` -- -v
#pm2 start ./node_modules/node-red/bin/node-red-pi --interpreter=bash -- --max-old-space-size=128 -v ./.node-red/flows_aiko.json
```
```json
{
"name": "red",
"version": "1.0.0",
"description": "quick red install",
"main": "./node_modules/node-red/red.js",
"author": "Aiko Mastboom",
"license": "MIT",
"dependencies": {
"node-red": "0.10.6",
"mongodb": "2.0.28",
"redis": "0.12.1",
"rpi-gpio": "0.5.1",
"arduino-firmata": "0.3.2",
"node-red-contrib-freeboard": "0.0.5",
"node-red-node-discovery": "0.0.6",
"node-red-node-snmp": "0.0.2"
}
}
```
```bash
/node_modules/node-red/nodes/core/hardware/nrgpio ver 0
0.5.11
mkdir -p /usr/share/doc
touch /usr/share/doc/python-rpi.gpio
vi node_modules/node-red/nodes/core/hardware/36-rpi-gpio.js
```
```diff
--- 36-rpi-gpio.js.orig 2015-05-04 12:48:42.242991732 +0000
+++ 36-rpi-gpio.js 2015-05-04 12:46:57.469316893 +0000
@@ -27,10 +27,10 @@
throw "Info : Ignoring Raspberry Pi specific node.";
}
- if (!fs.existsSync("/usr/share/doc/python-rpi.gpio")) {
- RED.log.warn("Can't find Pi RPi.GPIO python library.");
- throw "Warning : Can't find Pi RPi.GPIO python library.";
- }
+ //if (!fs.existsSync("/usr/share/doc/python-rpi.gpio")) {
+ // RED.log.warn("Can't find Pi RPi.GPIO python library.");
+ // throw "Warning : Can't find Pi RPi.GPIO python library.";
+ //}
if ( !(1 & parseInt ((fs.statSync(gpioCommand).mode & parseInt ("777", 8)).toString (8)[0]) )) {
RED.log.error(gpioCommand+" needs to be executable.");
```
```bash
docker run -i -t --cap-add=SYS_RAWIO --device /dev/ttyAMA0:/dev/ttyAMA0 --device /dev/ttyACM0:/dev/ttyACM0 --volume /dev/serial:/dev/serial --device /dev/mem:/dev/mem --add-host node1.aiko.sh:192.168.59.103 --add-host node2.aiko.sh:192.168.63.103 -p 1880:1880 aiko/node-red-pi bash
```