Trust is good control is better – JUnit Tests (parametrized and different arguments providers) with RxJava and some Mockito

Trust is good control is better – JUnit Tests (parametrized and different arguments providers) with RxJava and some Mockito

A follow up to Software tests – some basic JUnit testing in the area of RxJava. Not much text right now, just the announcement, the code below and the link to my github repo. Includes a build.gradle with all the needed dependencies.(There are already some other test concerning ConnectableObservables subscriptions and time of emit.) Short…

Deciphering the expected secret – Python this.s in a one liner

Deciphering the expected secret – Python this.s in a one liner

The little easter egg of “import this” in Python is well known – it shows Zen of Python. Nice guideline of how to keep your code clean. The Zen of Python, by Tim Peters Beautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested.Sparse…

Better scratch your balls than your frozen windshield – MQTT warning for nightly low temperatures with Node-RED querying a weather API

Better scratch your balls than your frozen windshield – MQTT warning for nightly low temperatures with Node-RED querying a weather API

I have a talent to forget to cover my car before a night with temperature below zero and the next morning I have to scratch away all the ice. As I really don’t like that I decided to build a warning mechanism for that. I already had a Node-RED flow querying the weather API to…

Easy peasy – querying weather API in Node-RED and publishing the current temperature to a MQTT broker

Easy peasy – querying weather API in Node-RED and publishing the current temperature to a MQTT broker

Precondition: Have your lokal MQTT broker and Node-RED installed and setup or access to a remote one. I recently added a http request node querying a weather API to Node-RED. After extracting, the current temperature is then published on the local MQTT and can be used by all devices connected to the broker.In this example…

Where are they going? – int angle to direction mapping in Python

Where are they going? – int angle to direction mapping in Python

A little util to map direction angle from weather API to ‘NW’ (SHORT, default) or ‘north west’ (LONG). Supports english (default) and german. An example API call to the weather API I am using and mapping the current wind direction to readable format. All my weather related code at github https://github.com/worksonmymachine-de/weather.

It’s raining codes and docs. WMO weather interpretation code mapping and translation for english and german

It’s raining codes and docs. WMO weather interpretation code mapping and translation for english and german

Just wanted to let you know I wrote a little mapper / translation for WMO weather codes as the (free) API I use for current weather and forecast also provides it. An example API call to the weather API I am using and mapping the current weather code to readable format. The code is on…

I don’t like grilled cheese – a thresholded IoT (MQTT) DHT22 sensor on with a D1 mini written in MicroPython with circuit diagram, casing and installation

I don’t like grilled cheese – a thresholded IoT (MQTT) DHT22 sensor on with a D1 mini written in MicroPython with circuit diagram, casing and installation

TLDR: An IoT sensor for temperature and humidity sending its values to a local MQTT server. Measuring interval and thresholding easy to configure. So much to write about a pretty small device and less than 100 lines of code including configuration, prints and comments. Hope you enjoy it! 🙂 I really like building and writing…

Making sure it’s cozy – IoT Neopixel LED stripe ambient light with DHT22 Temp/Hum sensor with MicroPython on a NodeMCU v3

Making sure it’s cozy – IoT Neopixel LED stripe ambient light with DHT22 Temp/Hum sensor with MicroPython on a NodeMCU v3

TLDR: Measures temp&hum in a configurable interval and with variable thresholds. Publishes to a mqtt server. Neopixels react to json data at a mqtt topic it is configured to subscibe. Single thread async implementation. Robust wifi and mqtt routines. Code at my github: https://github.com/worksonmymachine-de/iot_temptumsensor_ambilight This device is placed behind my main monitor and reads temperature…

YFNWG – your friendly neighbourhood washroom guard. IoT thresholded Temp/Hum/Open sensor with MicroPython on a D1 mini

YFNWG – your friendly neighbourhood washroom guard. IoT thresholded Temp/Hum/Open sensor with MicroPython on a D1 mini

It measures the temperature, humidity and open status of a window and send the values to the local MQTT broker if the values have changed (enough). The D1 got a nice housing on a solderable breadboard. The sensor cables can be plugged and unplugged into sockets on the breadboard. So I can easily exchange the…

Take small bites, chew long and eat slow, but this time it is obeyed – Splitting message in Node-RED containing a JSON object

Take small bites, chew long and eat slow, but this time it is obeyed – Splitting message in Node-RED containing a JSON object

This sounds trivial – and it is. When you know how to do it 🙂 There’s an example on the Node-RED homepage splitting a message generated from CSV, but this isnt the case here. I somehow did miss the point – if there is one made in the documentation – of how to split a…

Multitasking: “Fucking up multiple things at the same time!” – MicroPython uasyncio howto

Multitasking: “Fucking up multiple things at the same time!” – MicroPython uasyncio howto

Most code for simple IoT devices is a script with an endless loop with the code for the connected hardware like reading a sensor or polling something from the network followed by a delay. Keeping that pattern in mind helps to write new or convert your existing code for asynchronous execution. If you want to…