You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
Phill
Paraphraser
I wrote my first line of code in 1975. I've worked for the Aussie government, for local and multinational corporates, and in the tertiary education sector.
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
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
Your existing Node-RED service definition looks similar to this:
As a general principle, I'm not in favour of override files. I think they muddy the waters. I think you're much better off editing docker-compose.yml directly.
That said…
When you use IOTstack to manage Docker containers, you have access to two override mechanisms:
A compose-override.yml file. This mechanism is peculiar to IOTstack and is implemented by the so-called "new" menu on the master branch.
A docker-compose.override.yml file. This mechanism is part of docker-compose.
The following question appeared on the IOTstack Discord channel. It's the second part of a thread but I'll come back to the first part later:
I'm still struggling with this error. So the instruction says don't assign a password for root during the Debian installation. HOWEVER, the OS image that I'm using already comes with a default root password and I have to enter the default password to continue at the first step. Is there any way to remove this default password? Otherwise, it seems there is no way to continue the installations on this OS...
I don't want to over-sell this but the general thrust of the Unix industry over the last 20-odd years has been to avoid enabling the root account. In more recent times, security gurus, legislatures and best practice have been leading us to a world where there are no default accounts for anything.
IOTstack tutorial: removing bad data from InfluxDB
IOTstack tutorial: removing bad data from InfluxDB
A fairly common question from IOTstack users running InfluxDB is how to remove "bad data" from a database?
This gist focuses on InfluxDB 1.8 and the InfluxQL commands needed to operate upon an InfluxDB 1.8 database. You are entirely on your own if you are using InfluxDB 2.x.
prevention is better than cure
The best advice I can give you is to avoid the problem by ensuring that "bad data" never gets into your database in the first place. For example:
Checking your Raspberry Pi's view of its power supply (sometimes it's not the wall-wart)
Checking your Raspberry Pi's view of its power supply
Sometimes it seems like the first (and sometimes only) advice you get offered for almost any problem with a Raspberry Pi is "check your power supply". You think something like:
"hey, I'm using an official power supply sold as being matched with my Pi so how can there be any problem?"
You look up the specs then stick a controlled load across your supply and confirm that it can deliver the required number of Watts.
Do your Raspberry Pi's Network Interfaces freeze? This may solve it.
Do your Raspberry Pi's Network Interfaces 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.