Skip to content

Instantly share code, notes, and snippets.

Avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@Paraphraser
Paraphraser / IOTstack Wireguard - Quick and Dirty.md
Last active Jun 19, 2021
IOTstack tutorial: Quick and Dirty WireGuard
View IOTstack Wireguard - Quick and Dirty.md

IOTstack tutorial: Quick and Dirty WireGuard

Have you been tearing your hair out trying to get WireGuard to work under IOTstack? If so, you've (probably — hopefully) come to the right place.

This gist has been tested on both a Raspberry Pi 3B+ and 4B running Raspberry Pi OS (aka Raspbian). Your mileage may vary on other hardware or operating systems.


@Paraphraser
Paraphraser / Docker+OctoPrint - When your 3D printer turns on and off.md
Last active Jun 17, 2021
IOTstack+OctoPrint: When your 3D printer turns on and off
View Docker+OctoPrint - When your 3D printer turns on and off.md

IOTstack+OctoPrint
When your 3D printer turns on and off
Take 2

Task goals

  • Keep the OctoPrint Docker container service running even when the printer is switched off so that GCODE files can still be uploaded;
  • React gracefully and appropriately to the printer being switched on and off;
  • Have camera streaming follow the printer.

Contents

@Paraphraser
Paraphraser / MQTT_Node-Red_Influx.md
Last active Jun 12, 2021
Efficient recipe for getting MQTT data into an InfluxDB database using Node-Red
View MQTT_Node-Red_Influx.md

Recipe: from MQTT to InfluxDB via Node-Red

Introduction

Getting data produced by IoT sensors into a database is practically a mandatory step before effective visualisation (eg dashboards).

This recipe shows you how to get an MQTT payload into an InfluxDB database using three Node-Red nodes. It makes the following assumptions:

  • A client device of some kind publishing data to a topic via the MQTT protocol;
  • Mosquitto (MQTT broker);
@Paraphraser
Paraphraser / IOTstackNextCloud.md
Last active Jun 10, 2021
Getting Nextcloud to work under IOTstack
View IOTstackNextCloud.md

Getting Nextcloud to work under IOTstack

docker-compose.yml fragment

This is a docker-compose.yml that works on my Raspberry Pi 4B. Either use it as-is or copy everything except the first four and last 13 lines to the clipboard, then paste them into your existing docker-compose.yml, replacing any previous definitions for "nextcloud" and "nextcloud_db".

version: '3.6'

services:
@Paraphraser
Paraphraser / power_monitor_poc.md
Last active Jun 3, 2021
UPS monitor - back end - proof of concept
View power_monitor_poc.md

UPS monitor - back end - proof of concept

Assumptions

  • There exists a mechanism (unspecified) for acquiring status information from an Uninterruptible Power Supply;
  • That mechanism is available to Node-RED; and
  • There exists a Node-RED flow (unspecified) that is capable of interpreting the UPS status information and making decisions about when devices should power down and in what order.

Task Goal

@Paraphraser
Paraphraser / RPiWiFiFreeze.md
Last active Jun 1, 2021
Does your Raspberry Pi's Wireless Interface freeze? This may solve it.
View RPiWiFiFreeze.md

Does your Raspberry Pi's Wireless Interface freeze?

My Raspberry Pi 4 kept losing its wlan0 interface. I could usually reconnect via Ethernet but, from time to time, I noticed that the eth0 interface would also go walkabout.

I tried a lot of things but the one described here seems to have cured the problem. I have no idea why it works. It just does.

Step 0 - are you a Windows user?

The script shown in the next step should be created on your Raspberry Pi. Please do not make the mistake of selecting the text, copying it into a text editor on your Windows machine, saving the file, and then moving the file to your Raspberry Pi. Unless you take precautions, Windows will add its 0x0d 0x0a (CR+LF) line endings and those will stop the script from working properly on your Raspberry Pi.

@Paraphraser
Paraphraser / Mount Raspberry Pi home directory on your Mac.md
Created Mar 8, 2021
Using SSHFS to mount your Raspberry Pi's home directory on your Mac
View Mount Raspberry Pi home directory on your Mac.md

Using SSHFS to mount your Raspberry Pi's home directory on your Mac

It is useful to be able to mount your Raspberry Pi's file system on your Mac's desktop. The Raspberry Pi is ready to rock-'n-roll but some work needs to be done on the Mac. This gist assumes macOS Mojave 10.14. Your mileage may vary on earlier or later versions.

Set up passwordless SSH (optional)

You can make your life quite a bit simpler if you set up SSH on your Mac so that it can login to your Raspberry Pi without needing a password. Follow this tutorial.

The tutorial assumes two Raspberry Pis but there is no difference in approach if you use a Mac and a Pi, or two Macs.

@Paraphraser
Paraphraser / Enabling UDP support in InfluxDB.md
Last active May 21, 2021
Enabling UDP support in InfluxDB for SensorsIot/IOTstack
View Enabling UDP support in InfluxDB.md

Tutorial: Enabling UDP support in InfluxDB

Assumptions:

  • you are running SensorsIot/IOTstack with InfluxDB as one of the containers
  • you want to enable UDP support
  • your goal is to log traffic arriving on UDP port 8086 into an InfluxDB database named "udp".

This tutorial is specific to SensorsIot/IOTstack. You're on your own if you "get creative" and choose different ports or database names.

@Paraphraser
Paraphraser / Node-Red IOTstack hints.md
Last active May 13, 2021
Hints: Running Node-Red in IOTstack
View Node-Red IOTstack hints.md
@Paraphraser
Paraphraser / Installing Docker for IOTstack.md
Last active May 10, 2021
Installing Docker for IOTstack
View Installing Docker for IOTstack.md

Installing Docker for IOTstack

A lot of issues raised on the IOTstack Discord channel turn out to have improper installation of docker and/or docker-compose as their underlying cause. The hows and whys of this happening are not really important. This gist is intended to help you diagnose and understand the problem, and then recover without having to start from a clean image.

Symptoms of prior installation

The symptoms usually appear when trying to run menu.sh. You get messages:

  • Suggesting docker and/or docker-compose are already installed when you are reasonably sure they should not be.