I'm leaving in the problems I encountered in this project because you may encounter similar issues. 

DO NOT use the Home Automation HAOS images (https://github.com/home-assistant/operating-system/releases/download/8.5/haos_rpi4-64-8.5.img.xz) or use the IOTstack procedure (https://sensorsiot.github.io/IOTstack/Basic_setup/) to install NodeRED on the Rhaspberry Pi as these BOTH lack python3-rpi.gpio library needed for node-red-node-pi-gpio to function in NodeRED.

Here are my Pi Install instructions that have a WORKING gpio. 

[START HERE] Use bullseye to get a working GPIO.


MY preference is the 64 bit version: https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/

IMPORTANT: Use balenaEtcher to image 2022-09-22-raspios-bullseye-armhf-full.img

UPDATE TIP: Don't use a micro SD card, they are too slow and burn out with multiple writing. I used a fast USB thumb drive for a while, but realized a SSD is best for speed. Refer to this: https://linuxhint.com/how-to-clone-a-raspberry-pi-sd-card/

Here's what I used: https://amzn.to/3j3u8gp

To Install NodeRED, just follow the instructions here: https://nodered.org/docs/getting-started/raspberrypi

Now install Bluetooth stuff you will need:

sudo apt install bluetooth pi-bluetooth bluez blueman bluez-hcidump

sudo apt-get install python3-pip libglib2.0-dev

sudo pip3 install bluepy

Status: Pump control is working. My NodeRED code for pump control is linked in the files.

There is a dependency with my Node RED pump flow in that the Pump ON/OFF 'switch' uses node-red-contrib-ui_j to be installed in Node RED. Pump is wired to the NO1 ans COM1 connectors on the relay HAT. See photo above. 

I started with a Wanfei BLE moisture sensor. It is detectable by Rhaspberry Pi4, but I had issues reading values and parsing info.

The firmware is old on my Wanfei BLE moisture sensor and it doesn't communicate with the Xiaomi BLE Node, as old Mi Flora devices need a firmware update to work with Xiaomi BLE: https://github.com/home-assistant/core/issues/76236 

I can see the Wanfei BLE monitor is indeed sending data, but it is not being read/parsed by the Xiaomi BLE Node in NodeRED. BUY the right Xiaomi BLE plant monitor sensor! I found one here https://www.ebay.ca/itm/184592497350

I've ordered a 2022 Xiaomi Mi Bluetooth Monitor Flower Plants Care Smart Tester Flora Sensor. If the "Flower Care" app on iOS cannot detect your Wanfei BLE moisture sensor, it's because the firmware is too old on it and needs updating. Flower Care does not bind or detect with firmware v 2.7.0 on your moisture sensor. https://community.home-assistant.io/t/northfifteen-connected-home-plant-monitor-mi-flora-firmware-update-to-work-with-esphome/153198

If the 'Flower Care" app could detect the Wanfei Moisture sensor, it could update it's firmware, but sadly it cannnot detect it. 

[UPDATE Dec 19, 2022]:  2022 Xiaomi Mi Bluetooth Monitor arrived. It can connect to the "Flower Care" app. 

Was hoping I could use a simple flow like this to read the data from my "Flower care" but the Xiaomi node isn't working. Others are having issues too, it may be due to Xiaomi is sending encrypted data or the MiFlora isn't fully supported. https://github.com/eschava/node-red-contrib-xiaomi-ble/issues/32

Changing approach. I have found other techniques that scan, write to a file, then read data from file. Also found a method that uses a daemon to scan BLE and send data to an MQTT broker. That seems like the cleanest strategy so using that.

Do not Install MQTT broker from these instructions: https://www.catchpoint.com/network-admin-guide/mqtt-broker

WARNING: Do not change your hosts file as they describe. Don't install the AFW (firewall) as it unnecessarily...

Read more »