Skip to content

Instantly share code, notes, and snippets.

View Paraphraser's full-sized avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@Paraphraser
Paraphraser / IOTstack tutorial - two instances of Node-RED.md
Created July 24, 2023 11:32
IOTstack tutorial: running two instances of Node-RED on the same host

IOTstack tutorial: running two instances of Node-RED on the same host

Suppose you have a Node-RED container running but you want to create a test version where you can experiment safely without disturbing the original.

Running multiple instances of a container is something Docker excels at! This tutorial explains how to set it up. It will also help you to understand the differences between containers running in host mode and non-host mode.

Assumptions

  1. Your existing Node-RED service definition looks similar to this:
@Paraphraser
Paraphraser / CalculatingBarometricPressureTrend.md
Last active July 14, 2023 03:37
Calculating barometric pressure trend

Calculating barometric pressure trend

This gist is a response to a Discord question. It explains my approach to deciding whether barometric pressure is rising, falling or remaining steady.

I do the trend calculation in Arduino (ESP8266) code. I tried to mimic the idea of setting the reference needle on a real barometer, waiting an hour, then seeing which way the pressure needle had moved with respect to the reference. The wrinkle is that "the last hour" is a moving window that updates every 10 minutes.

The BMP085 sensor is polled every 10 minutes. Until there are six observations (eg after a reboot) the code returns "training".

After that, the code does a least-squares regression on the last six observations (ie the last hour of data) to find the linear equation of best fit. In effect, the algorithm assumes that knowing the time (independent variable on the X axis) at some point in the past hour would permit the pressure at that time (dependent variable on the Y axis) to be estimated with some degree of

@Paraphraser
Paraphraser / NodeRED_MidnightredTheme.md
Last active July 14, 2023 03:35
Recipe for installing Node-RED Midnight-red theme under IOTstack
@Paraphraser
Paraphraser / ZeroTier-macOS-menu-bar.md
Created June 16, 2023 06:12
ZeroTier GUI controls in the macOS (Ventura) menu bar

On ZeroTier, macOS and the menu bar

Over at the ZeroTier forum is a thread:

The thread covers two distinct problems:

  1. The ZeroTier One.pkg package downloaded from ZeroTier.com won't install on macOS Ventura.
  2. The package installs but the associated app won't start and the menu bar item is not present.
@Paraphraser
Paraphraser / Tutorial - Debugging MQTT traffic flows in IOTstack.md
Last active April 28, 2023 02:06
Tutorial: Debugging MQTT traffic flows in IOTstack

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 / Logging CPU Temperatures.md
Created August 22, 2021 14:05
IOTstack Tutorial: Logging CPU Temperatures

IOTstack Tutorial: Logging CPU Temperatures

introduction

This gist answers a Discord question. It explains my approach to collecting CPU temperatures by sending the data as an MQTT payload.

I like to think of this approach as working with the MING (Mosquitto, InfluxDB, Node-RED, Grafana) paradigm rather than fighting against it (eg using approaches like SSH calling out of the Node-RED container).

The approach is not tied to the Raspberry Pi that is running IOTstack. If you have several Raspberry Pis, they can all log their temperatures to the Raspberry Pi running IOTstack using exactly the same mechanism.

@Paraphraser
Paraphraser / IOTstack tutorial – adding a second drive.md
Last active March 23, 2023 11:32
IOTstack tutorial - adding a second drive

IOTstack tutorial – adding a second drive

Problem statement

This issue has come up a few times on Discord. The question can be summarised like this:

My existing IOTstack installation is running out of space on my primary drive. I have another drive. How do I move the "volumes" directory to the new drive?

This example is based on a Raspberry Pi 4 which is booting from a 500GB USB3 SSD. I will show you how to use a 32GB USB3 "thumb drive" as the secondary drive and move ~/IOTstack/volumes onto it.

@Paraphraser
Paraphraser / TheRetainFlag.md
Created September 18, 2020 02:42
MQTT and the retain flag

Tutorial: MQTT and the retain flag

Assumptions and setup

This tutorial assumes:

  • a single computer (like a Raspberry Pi)
  • MQTT broker (like Mosquitto) running
  • the mosquitto_pub and mosquitto_sub commands are available.
@Paraphraser
Paraphraser / IOTstack-NodeRED-pigpiod.md
Last active February 15, 2023 04:13
IOTstack + Node-RED + pigpiod

IOTstack + Node-RED + pigpiod

Problem Statement

The following problem was reported on the IOTstack Discord channel:

Today I rebuild my IOTstack from scratch using the Pibuild process and after restoring my nodered flows I noticed that my serials and GPIO are not connecting anymore.

I don't use node-red-node-pi-gpiod myself but I have been able to reproduce the problem.

@Paraphraser
Paraphraser / IOTstack-InfluxDB-tsi1.md
Last active February 2, 2023 03:32
On IOTstack, InfluxDB 1.8 & `INFLUXDB_DATA_INDEX_VERSION`

On IOTstack, InfluxDB 1.8 & INFLUXDB_DATA_INDEX_VERSION

Updated 2022-05-19

  • Additional observations since reverting to in-memory indexing.

the trigger question

On March 12 2022 I noticed a post on Discord by Ukkopahis saying: