Skip to content

Instantly share code, notes, and snippets.

Avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@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 / 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 / Using the PiHole container as your container DNS.md
Last active May 4, 2021
IOTstack - Using the PiHole container as your container DNS
View Using the PiHole container as your container DNS.md

IOTstack - Using the PiHole container as your container DNS

First, a small bit of editorialising (my gist, my rules). PiHole is an excellent ad-blocker. It's perfectly OK for just about every other device on your home network to use PiHole as its primary DNS.

The one device in your network that shouldn't use PiHole-in-a-container for its DNS is the Raspberry Pi running PiHole in a Docker container. I'll go so far as to describe it as a seriously dumb idea.

Why? Several reasons:

  • Containers start quite late in the boot cycle. Any process starting before Docker that depends on the DNS being "there" can be disappointed. PiHole being late to the party and occasionally disappearing when you do perfectly ordinary things like…
  • … Taking down your stack can trigger resolver failover conditions which don't always recover gracefully. You might think your DNS setup is working just fine with the PiHole container in the prime role but then it all turns to custard and you don't know why.
@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 / 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 / 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 / Tutorial - Debugging MQTT traffic flows in IOTstack.md
Last active Apr 19, 2021
Tutorial: Debugging MQTT traffic flows in IOTstack
View Tutorial - Debugging MQTT traffic flows in IOTstack.md

Tutorial: Debugging MQTT traffic flows in IOTstack

You have built an ESP32, ESP8266 or similar project. You are sure it is sending payloads via MQTT but the data doesn't seem to be arriving in Node-Red. You're at a bit of a loss as to what to do next.

This tutorial is specific to IOTstack where Mosquitto and Node-Red are running as Docker containers on a Raspberry Pi. Much of it is probably applicable to other environments but "your mileage may vary".

Related resources

@Paraphraser
Paraphraser / Mosquitto security under IOTstack.md
Last active Mar 31, 2021
Mosquitto password protection in IOTstack
View Mosquitto security under IOTstack.md

Mosquitto password protection in IOTstack

Setting up passwords for Mosquitto is a topic that comes up fairly frequently in GitHub issues and on the Discord channel, usually as a result of it not working as expected.

The purpose of this gist is to explain the how-to of password setup, as at Feb 16, 2021 when 2.0.7 was the "latest" version of Mosquitto.

Mosquitto underwent some changes between 1.6.x and 2.0, including how passwords were handled. See Migrating to Mosquitto 2.0.

Contents

@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.
@Paraphraser
Paraphraser / Node-Red IOTstack hints.md
Last active May 13, 2021
Hints: Running Node-Red in IOTstack
View Node-Red IOTstack hints.md