Skip to content

Instantly share code, notes, and snippets.

@chrowe
Last active February 13, 2017 01:18
Show Gist options
  • Save chrowe/fe8edd7553c678745f5f3ceff9a861a3 to your computer and use it in GitHub Desktop.
Save chrowe/fe8edd7553c678745f5f3ceff9a861a3 to your computer and use it in GitHub Desktop.
Node-red

Install

Raspberry Pi B1+

  1. Started with a fresh copy of Raspian Jessie Lite from https://www.raspberrypi.org/downloads/raspbian/
  2. Burned to 4GB SD card using https://etcher.io/
  3. Followed https://randomnerdtutorials.com/getting-started-with-node-red-on-raspberry-pi/

👍

Hello world

Send number on click

  1. Followed https://learn.adafruit.com/adafruit-io/mqtt-api#connection-details and created
[{"id":"c865e6b4.8ad0c8","type":"inject","z":"e068acb9.a7ca9","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"x":137.5,"y":92,"wires":[["ede9f133.d5256","a94e654f.77a0a8"]]},{"id":"ede9f133.d5256","type":"debug","z":"e068acb9.a7ca9","name":"","active":true,"console":"false","complete":"false","x":375.5,"y":109,"wires":[]},{"id":"a94e654f.77a0a8","type":"mqtt out","z":"e068acb9.a7ca9","name":"Adafruit.IO","topic":"chrowe/feeds/red","qos":"0","retain":"","broker":"8a62cdaf.eb581","x":370.5,"y":187,"wires":[]},{"id":"8a62cdaf.eb581","type":"mqtt-broker","z":"","broker":"io.adafruit.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

For some reason importing this seems to cause problems though. I had to build it by hand and it worked fine. 2. See https://io.adafruit.com/chrowe/feeds/red for data sent

👍

Read temp readings from 1wire sensor on GPIO

There doesn't seem to be a single clear way to do this

Install 1wire node

  1. Install npm sudo apt install npm
  2. Install https://www.npmjs.com/package/node-red-contrib-1wire sudo npm install -g node-red-contrib-1wire https://nodered.org/docs/getting-started/adding-nodes
  3. Restart node-red https://nodered.org/docs/hardware/raspberrypi node-red-stop node-red-start This seems to leave you in the start command but control-C seems to not stop Node Red
  4. In Node Red http://10.0.1.13:1880/# go to Hamburger menu > Manage palette.
  5. Select install tab and search for "1wire"
  6. Click "Install"
  7. Find "1 wire" node under Functions

👍

Set up flow

[{"id":"70699b9a.97fe84","type":"inject","z":"2663e24b.c2337e","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"10","crontab":"","once":false,"x":97.5,"y":137,"wires":[["df598541.6c5668","57fb7fc2.f52e5"]]}]

See https://io.adafruit.com/chrowe/dashboards/solar-hot-water for output

👍

/etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	ssid="lcc"
	#psk=""
	psk=
}
@chrowe
Copy link
Author

chrowe commented Feb 8, 2017

No wpa_supplicant.conf was generated by https://github.com/pirate-sh/ip/blob/master/lib/ReconfigureWifi.js with psk populated

@chrowe
Copy link
Author

chrowe commented Feb 13, 2017

http://tech.scargill.net/backing-up-node-red/ helped me figure out how to copy flows from one pi to another

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment