Radxa cubie A7z WiFi monitor mode worked OK with ESPNOW

I base on Claude AI to edit driver of WiFi chip on RADXA A7z V1.1 no UFS chip.
Claude AI can help to edit driver for monitor mode in transmit and receive data to work OK with ESPNOW mesh network. ESPNOW bridge to log data to InfluxDB depend to your config in ESP module. AI can help me write new Python bridge File.

Radxa A7Z monitor mode (receive + transmit) and ESP-NOW mesh to InfluxDB

Complete build guide, from a fresh board to a working gauge. Tested on: Radxa Cubie A7Z, Debian 13 (trixie), kernel 6.6.98-5-aw2511, USB Wi-Fi chip AIC8800D80 (USB ID a69c:8d81), driver package aic8800-usb 5.0+git20260123.5f7be68d-8, InfluxDB 2.9.1 and ESP8266 nodes.

0. What you are building

ESP8266 node(s) --ESP-NOW, channel 11–> Radxa wlan0 (monitor mode) → mesh_gateway → Python bridge → InfluxDB → gauge / graph
← PROVISION and ACK, injected by the Radxa –

  • The Radxa’s Wi-Fi chip is put into monitor mode with a patched driver. It receives every frame and can also transmit raw frames.

  • mesh_gateway answers each node’s HELLO with PROVISION and each DATA packet with ACK. A node deletes a reading from its flash only after that ACK, so nothing is lost while the Radxa is off.

  • A Python script writes every reading to InfluxDB, where a Gauge shows it.

Tested on real hardware: patched driver (receive and transmit), gateway provisioning and ACK with one ESP8266, bridge to InfluxDB, gauge and graph.

Not tested yet: several nodes on one gateway (Part G.3 contains the extra node code), relaying between nodes, 5 GHz, long unattended runs.

1. Before you start

  • Keep the USB Ethernet cable connected for the whole guide. You rebuild the Wi-Fi driver, so do not work over Wi-Fi.

  • Run the blocks in order, in one terminal. If you close the terminal, run block B1 again to restore the variables.

  • Never paste passwords or API tokens into chat or documents.

  • Each ESP8266 talks to exactly one Radxa: the node’s GATEWAY_MAC is that Radxa’s wlan0 MAC address, which mesh_gateway prints when it starts.

Part A. Base setup

A1. Check the board

export PATH=“$PATH:/usr/sbin”
echo ‘export PATH=“$PATH:/usr/sbin”’ >> ~/.bashrc
uname -r
dkms status
ls /usr/src | grep aic8800
ls -d /lib/modules/$(uname -r)/build
lsusb | grep -i aic

You need: an aic8800-usb … installed line, a folder in /usr/src, the kernel headers folder, and the AIC USB device. If any of them is missing, stop and install the Radxa kernel headers and aic8800 package for your image first.

A2. Install the tools

sudo apt update
sudo apt install -y git build-essential libpcap-dev python3 python3-requests
sudo apt install -y curl gpg nano tcpdump

A3. Limit DKMS to one compile job

With the default of 8 jobs the driver build was extremely slow on this board.

sudo cp /etc/dkms/framework.conf /etc/dkms/framework.conf.backup
F=/etc/dkms/framework.conf
sudo sed -i ‘s/^#\s*parallel_jobs=.*/parallel_jobs=1/’ $F
grep -n parallel_jobs /etc/dkms/framework.conf

The last line must show parallel_jobs=1.

Part B. Patch the Wi-Fi driver for monitor receive and transmit

Why this is needed: with the stock driver the board crashes (kernel panic) when wlan0 enters monitor mode and receives certain frames, because the receive code uses a NULL pointer (skb_monitor) when the option CONFIG_RWNX_MON_DATA is off. The monitor transmit code also exists in the source but is compiled out (CONFIG_RWNX_MON_XMIT defaults to n). The patches below fix both. Every script changes nothing if the source does not match exactly what was tested.

B1. Variables and backups

export PATH=“$PATH:/usr/sbin”
VER=$(ls /usr/src | sed -n ‘s/^aic8800-usb-//p’ | head -1)
DRV=“/usr/src/aic8800-usb-$VER/USB/driver_fw/drivers/aic8800/aic8800_fdrv”
echo “VER=$VER”
sudo mkdir -p /root/aic8800-monitor-backup
sudo cp -a “$DRV/rwnx_rx.c” /root/aic8800-monitor-backup/rwnx_rx.c.orig
sudo cp -a “$DRV/rwnx_tx.c” /root/aic8800-monitor-backup/rwnx_tx.c.orig
sudo cp -a “$DRV/Makefile” /root/aic8800-monitor-backup/Makefile.orig
sudo ls -l /root/aic8800-monitor-backup

B2. Receive patch (rwnx_rx.c)

sudo VER=“$VER” python3 - <<‘PY’
import os, re
from pathlib import Path
ver = os.environ[“VER”]
p = Path(f"/usr/src/aic8800-usb-{ver}/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_rx.c")
s = p.read_text()
if “MON_FIX” in s or “MON_GUARD” in s:
raise SystemExit(“ERROR: already patched. No changes made.”)

needle = “skb_reset_tail_pointer(skb_monitor);”
if s.count(needle) != 1:
raise SystemExit(“ERROR: guard anchor found %d times (need 1). No changes made.” % s.count(needle))
guard = ‘’‘/* MON_GUARD: no monitor skb (copy failed or bad length) */
if (!skb_monitor) {
dev_kfree_skb(skb);
goto end;
}
‘’’
s = s.replace(needle, guard + needle, 1)

pat1 = re.compile(
r’#ifdef CONFIG_RWNX_MON_DATA\s*\n\s*skb_monitor = skb_copy_expand\(skb, rtap_len, 0, GFP_ATOMIC\);\s*\n’
r’\s*skb_monitor->data \+= \(msdu_offset \+ 2\);[^\n]*\n\s*\n?\s*//Save frame length\s*\n’
r’\s*frm_len = le32_to_cpu\(hw_rxhdr->hwvect\.len\);\s*\n\s*#endif’)
rep1 = ‘’‘/* MON_FIX: build the monitor copy without CONFIG_RWNX_MON_DATA, bounds-checked */
{
u32 mon_len = le32_to_cpu(hw_rxhdr->hwvect.len);
if (mon_len && (msdu_offset + 2 + mon_len) <= skb->len) {
skb_monitor = skb_copy_expand(skb, rtap_len, 0, GFP_ATOMIC);
if (skb_monitor) {
skb_monitor->data += (msdu_offset + 2);
frm_len = mon_len;
}
}
}’‘’
s, n1 = pat1.subn(rep1, s)

pat2 = re.compile(
r’if \(status == RX_STAT_MONITOR\) \{\s*\n\s*if \(skb_monitor != skb\) \{\s*\n\s*dev_kfree_skb\(skb\);\s*\n\s*\}\s*\n\s*\}‘)
rep2 = ‘’‘if (skb_monitor != skb) {
dev_kfree_skb(skb);
}
if (status != RX_STAT_MONITOR)
goto end; /* MON_FIX: no network forwarding in monitor mode */’’’
s, n2 = pat2.subn(rep2, s)

if n1 != 1 or n2 != 1:
raise SystemExit(“ERROR: fix patterns matched n1=%d n2=%d (need 1 and 1). No changes made.” % (n1, n2))
p.write_text(s)
print(“patched”)
PY

sudo grep -n -E ‘MON_GUARD|MON_FIX’ “$DRV/rwnx_rx.c”

Expected: patched and three marker lines. If you see ERROR, nothing was changed: your driver source differs from the tested one, so do not continue.

B3. Transmit patch (rwnx_tx.c) and Makefile switch

sudo VER=“$VER” python3 - <<‘PY’
import os
from pathlib import Path
ver = os.environ[“VER”]
p = Path(f"/usr/src/aic8800-usb-{ver}/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_tx.c")
s = p.read_text()
if “MON_TX_GUARD” in s:
raise SystemExit(“ERROR: already patched. No changes made.”)
start = s.index(“netdev_tx_t rwnx_start_monitor_if_xmit(”)
end = s.index(“return NETDEV_TX_OK;”, start)
body = s[start:end]
a1 = " pframe = rtap_buf + rtap_len;"
a2 = " txhdr->sw_hdr = sw_txhdr;"
if body.count(a1) != 1 or body.count(a2) != 1:
raise SystemExit(“ERROR: anchors found %d and %d times (need 1 and 1). No changes made.” % (body.count(a1), body.count(a2)))
g1 = ‘’’
/* MON_TX_GUARD: need at least an 802.11 management header */
if (frame_len < 24) {
AICWFDBG(LOGERROR, “%s frame too short: %d”, _func_, frame_len);
goto free_tag;
}‘’’
g2 = ‘’’ memset(sw_txhdr, 0, sizeof(*sw_txhdr)); /* MON_TX_GUARD */
‘’’
body = body.replace(a1, a1 + g1, 1)
body = body.replace(a2, g2 + a2, 1)
p.write_text(s[:start] + body + s[end:])
print(“patched”)
PY

sudo grep -n ‘MON_TX_GUARD’ “$DRV/rwnx_tx.c”

cd “$DRV”
sudo sed -i ‘s/^CONFIG_RWNX_MON_XMIT ?= n/CONFIG_RWNX_MON_XMIT = y/’ Makefile
grep -n ‘CONFIG_RWNX_MON_XMIT’ Makefile

Expected: patched, two MON_TX_GUARD lines, and CONFIG_RWNX_MON_XMIT = y in the Makefile. Do not enable CONFIG_RWNX_MON_DATA: the firmware reports MON_DATA=0, and enabling it only brings back the crashing code path.

B4. Build, install, reboot

sudo dkms build --force -m aic8800-usb -v “$VER” -k “$(uname -r)” -a aarch64 -j 1
echo “build rc=$?”
sudo grep -n -E ’ error|undefined’ /var/lib/dkms/aic8800-usb/$VER/$(uname -r)/aarch64/log/make.log | head

The build takes several minutes. Continue only if it prints build rc=0 and no error lines. If dpkg asks about a modified influxdata.list or similar later, that is a different step; here no questions are expected.

sudo dkms install --force -m aic8800-usb -v “$VER” -k “$(uname -r)”
sync
sudo reboot

Part C. Monitor mode on wlan0

C1. Test by hand first

Do this once before creating the boot service, so a driver problem cannot cause a reboot loop.

export PATH=“$PATH:/usr/sbin”
sudo nmcli device set wlan0 managed no
sudo ip link set wlan0 down; sleep 1
sudo iw dev wlan0 set type monitor
sudo ip link set wlan0 up; sleep 2
sudo iw dev wlan0 set channel 11
iw dev wlan0 info | grep -E ‘type|channel’
sudo dmesg | grep -i ‘monitor xmit’
sync
sudo tcpdump -i wlan0 -e -n -c 10

Expected: type monitor, channel 11, the line monitor xmit: netif_carrier_on, and tcpdump reporting IEEE802_11_RADIO with frames. The sleep commands matter: without them the driver can answer Device or resource busy (-16). Always bring the interface up before setting the channel.

If the board reboots, the receive patch is not in the running driver: check dkms status and Part B.

C2. Make it start at boot

sudo tee /etc/NetworkManager/conf.d/99-unmanaged-wlan0.conf >/dev/null <<‘EOF’
[keyfile]
unmanaged-devices=interface-name:wlan0
EOF

sudo tee /etc/systemd/system/wlan0-monitor.service >/dev/null <<‘EOF’
[Unit]
Description=Put wlan0 in monitor mode
After=sys-subsystem-net-devices-wlan0.device NetworkManager.service
Wants=sys-subsystem-net-devices-wlan0.device

[Service]
Type=oneshot
RemainAfterExit=yes
Environment=PATH=/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/usr/sbin/ip link set wlan0 down
ExecStart=/bin/sleep 1
ExecStart=/usr/sbin/iw dev wlan0 set type monitor
ExecStart=/usr/sbin/ip link set wlan0 up
ExecStart=/bin/sleep 2
ExecStart=/usr/sbin/iw dev wlan0 set channel 11

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl restart NetworkManager
sudo systemctl enable wlan0-monitor.service

Change channel 11 if you use another channel; it must match MESH_WIFI_CHANNEL in the node firmware. A journal that survives reboots helps when debugging a crash:

sudo mkdir -p /var/log/journal && sudo systemctl restart systemd-journald

Part D. ESP-NOW library and the gateway program

D1. Download the library

cd ~
git clone GitHub - thomasfla/Linux-ESPNOW: An attempt at implementing a direct link between a linux station and an ESP module using ESPNOW protocol for real time robot control · GitHub
cd ~/Linux-ESPNOW/ESPNOW_lib
grep -rn “CHANNEL_freq_11” --include=*.h . | head -3
ls src src/Includes

The grep must show the constant CHANNEL_freq_11. If it does not, look for the matching name with grep -rn CHANNEL_freq --include=*.h . and use that name below.

D2. Create mesh_gateway.cpp

This program reads the interface’s own MAC address, so it is identical on every board.

cd ~/Linux-ESPNOW/ESPNOW_lib
cat > src/mesh_gateway.cpp <<‘EOF’
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include 
#include 
#include “ESPNOW_manager.h”
#include “ESPNOW_types.h”

#define NETWORK_ID 0x5E51A7C2u
#define ID_GATEWAY 1u
#define MSG_DATA 1
#define MSG_ACK 3
#define MSG_HELLO 5
#define MSG_PROVISION 6
#define MESH_TTL 5

#pragma pack(push, 1)
struct MeshPacket {
uint32_t network_id, src_id, dest_id, seq;
uint8_t msg_type, ttl;
uint8_t payload[56];
uint16_t crc;
};
#pragma pack(pop)
static_assert(sizeof(MeshPacket) == 76, “MeshPacket must be 76 bytes”);

static uint16_t crc16(const uint8_t *d, size_t n) {
uint16_t crc = 0xFFFF;
while (n–) {
crc ^= (uint16_t)(*d++) << 8;
for (int i = 0; i < 8; i++)
crc = (crc & 0x8000) ? ((crc << 1) ^ 0x1021) : (crc << 1);
}
return crc;
}

static uint8_t my_mac[6] = {0, 0, 0, 0, 0, 0};
static uint8_t bcast[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
static std::mutex mtx;
static std::deque outq;
ESPNOW_manager *handler;

static bool readMac(const char *iface, uint8_t *mac) {
char path[128];
snprintf(path, sizeof(path), “/sys/class/net/%s/address”, iface);
FILE *f = fopen(path, “r”);
if (!f) return false;
unsigned m[6];
int n = fscanf(f, “%x:%x:%x:%x:%x:%x”, &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]);
fclose(f);
if (n != 6) return false;
for (int i = 0; i < 6; i++) mac[i] = (uint8_t)m[i];
return true;
}

static uint32_t idFromUuid(const uint8_t *u) {
uint32_t h = 2166136261u;
for (int i = 0; i < 16; i++) { h ^= u[i]; h *= 16777619u; }
return (h & 0x7FFFFFFFu) | 0x100u;
}

static void queuePacket(uint32_t dest, uint8_t type, uint32_t seq,
const uint8_t *payload, size_t plen) {
MeshPacket p;
memset(&p, 0, sizeof(p));
p.network_id = NETWORK_ID;
p.src_id = ID_GATEWAY;
p.dest_id = dest;
p.seq = seq;
p.msg_type = type;
p.ttl = MESH_TTL;
if (payload) memcpy(p.payload, payload, plen);
p.crc = crc16((const uint8_t *)&p, offsetof(MeshPacket, crc));
std::lock_guardstd::mutex l(mtx);
outq.push_back(p);
}

void callback(uint8_t src_mac[6], uint8_t *data, int len) {
if (len < (int)sizeof(MeshPacket)) return;
if (memcmp(src_mac, my_mac, 6) == 0) return;
MeshPacket p;
memcpy(&p, data, sizeof(p));
if (p.network_id != NETWORK_ID) return;
if (p.crc != crc16((const uint8_t *)&p, offsetof(MeshPacket, crc))) return;

if (p.msg_type == MSG_HELLO) {
uint32_t id = idFromUuid(p.payload);
uint8_t pl[20];
memcpy(pl, &id, 4);
memcpy(pl + 4, p.payload, 16); // node UUID, so only that node accepts the ID
queuePacket(id, MSG_PROVISION, 0, pl, 20);
fprintf(stderr, “HELLO from %02x:%02x:%02x:%02x:%02x:%02x → PROVISION id %u\n”,
src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], id);
} else if (p.msg_type == MSG_DATA) {
uint32_t seq = p.seq, src = p.src_id;
uint8_t pl[4];
memcpy(pl, &seq, 4);
queuePacket(src, MSG_ACK, seq, pl, 4);
unsigned adc = p.payload[0] | (p.payload[1] << 8);
fprintf(stderr, “DATA node=%u seq=%u adc=%u digital=%u → ACK queued\n”,
src, seq, adc, p.payload[2]);
printf(“PAYLOAD [%d]: “, len);
for (int i = 0; i < len; i++) printf(”%02x%s”, data[i], (i + 1) % 4 == 0 ? " " : “”);
printf(“\n”);
fflush(stdout);
}
}

int main(int argc, char **argv) {
if (argc < 2) { fprintf(stderr, “usage: mesh_gateway wlan0\n”); return 1; }
if (!readMac(argv[1], my_mac)) { fprintf(stderr, “cannot read MAC of %s\n”, argv[1]); return 1; }
fprintf(stderr, “gateway MAC (use this as GATEWAY_MAC in the node): %02X:%02X:%02X:%02X:%02X:%02X\n”,
my_mac[0], my_mac[1], my_mac[2], my_mac[3], my_mac[4], my_mac[5]);
nice(-20);
handler = new ESPNOW_manager(argv[1], DATARATE_24Mbps, CHANNEL_freq_11,
my_mac, bcast, false);
handler->set_recv_callback(&callback);
handler->start();
fprintf(stderr, “mesh_gateway running on channel 11\n”);
while (1) {
MeshPacket p;
bool have = false;
{
std::lock_guardstd::mutex l(mtx);
if (!outq.empty()) { p = outq.front(); outq.pop_front(); have = true; }
}
if (have) handler->send((uint8_t *)&p, sizeof(p));
else usleep(1000);
}
}
EOF

D3. Compile

cd ~/Linux-ESPNOW/ESPNOW_lib
mkdir -p bin
g++ -g -Wall -std=c++11 -I src/Includes/ src/mesh_gateway.cpp src/ESPNOW_manager.cpp src/ESPNOW_types.cpp -o bin/mesh_gateway -lpthread -lpcap
ls -l bin/mesh_gateway

Warnings are fine; ls must show the file. Print the gateway MAC now, you need it for the node firmware:

cat /sys/class/net/wlan0/address

Part E. InfluxDB

E1. Install

This follows InfluxData’s Debian instructions and verifies the key by its fingerprint.

sudo mkdir -p /etc/apt/keyrings
cd ~
curl --silent --location -O https://repos.influxdata.com/influxdata-archive.key

if gpg --show-keys --with-colons ~/influxdata-archive.key | grep -q ‘24C975CBA61A024EE1B631787C3D57159FC2F927’; then
echo “KEY OK”
gpg --dearmor < ~/influxdata-archive.key | sudo tee /etc/apt/keyrings/influxdata-archive.gpg > /dev/null
echo ‘deb [signed-by=/etc/apt/keyrings/influxdata-archive.gpg] 
 stable main’ | sudo tee /etc/apt/sources.list.d/influxdata.list
else
echo “KEY MISMATCH - do not continue”
fi

Continue only after KEY OK:

sudo apt-get update
sudo apt-get install -y influxdb2
sudo systemctl enable --now influxdb
systemctl status influxdb --no-pager
ip -br address

If dpkg asks what to do about a modified influxdata.list, choose install the package maintainer’s version. The status must say active (running).

Choose install the package maintainer’s version

E2. First-time setup in the browser

Open http://RADXA-IP:8086 from another computer on the same network.

  1. Get Started, then create a username and password.

  2. Organization: Sunching. Bucket: espnow01. (Any names work, but they must match the bridge script in Part F. This guide uses these.)

  3. Copy the operator token that is shown and keep it private. Since InfluxDB 2.9 it cannot be displayed again.

  4. Create a limited token for the bridge: Load Data → API Tokens → Generate API Token → Custom API Token, name it bridge, tick Write for the bucket espnow01 only, and copy it.

E3. Test a write

read -s -p "Paste the token, then press Enter: " TOK; echo
curl -i --request POST “``http://localhost:8086/api/v2/write?org=Sunching&bucket=espnow01&precision=s``” \
–header “Authorization: Token $TOK” \
–data-binary “espnow01,node=1 temp_c=23.5”
unset TOK

The first line of the answer must be HTTP/1.1 204 No Content. 401 means a wrong token, 404 a wrong organization or bucket name.

E4. Gauge

Data Explorer: bucket espnow01, measurement espnow01, field temp_c, range Past 1h, Submit. Change the visualization to Gauge, set the range and unit with the gear icon, then Save As → Dashboard Cell.

Part F. Python bridge and boot services

F1. Create the bridge script

cat > ~/espnow_bridge.py <<‘EOF’
#!/usr/bin/env python3
import os, socket, struct, subprocess, requests

RECEIVER_BIN = “/home/radxa/Linux-ESPNOW/ESPNOW_lib/bin/mesh_gateway”
INTERFACE = “wlan0”
INFLUX = “http://localhost:8086/api/v2/write?org=Sunching&bucket=espnow01&precision=s”
TOKEN = “PUT_YOUR_NEW_TOKEN_HERE”
GATEWAY = socket.gethostname().replace(" “, “_”)
NETWORK_ID = 0x5E51A7C2
MSG_DATA = 1
PKT = struct.Struct(”<IIIIBB56sH") # 76 bytes, same as MeshPacket

def crc16(data):
crc = 0xFFFF
for b in data:
crc ^= b << 8
for _ in range(8):
if crc & 0x8000:
crc = ((crc << 1) ^ 0x1021) & 0xFFFF
else:
crc = (crc << 1) & 0xFFFF
return crc

def adc_to_celsius(adc):
return float(adc) # TODO: replace with the formula for your sensor

seen = set()
env = dict(os.environ, LD_LIBRARY_PATH=os.path.dirname(RECEIVER_BIN))
proc = subprocess.Popen([“stdbuf”, “-oL”, RECEIVER_BIN, INTERFACE],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
text=True, env=env)
print(“bridge started”, flush=True)

for line in proc.stdout:
if “PAYLOAD [” not in line:
continue
try:
raw = bytes.fromhex(line.split(“: “, 1)[1].replace(” “, “”).strip())
if len(raw) < PKT.size:
continue
net, src, dst, seq, mtype, ttl, payload, crc = PKT.unpack(raw[:PKT.size])
if net != NETWORK_ID or crc != crc16(raw[:74]) or mtype != MSG_DATA:
continue
if (src, seq) in seen:
continue
adc, digital, uptime = struct.unpack_from(”<HBI”, payload, 0)
body = (f"espnow01,node={src},gateway={GATEWAY} adc={adc}i,digital={digital}i,"
f"uptime_s={uptime}i,temp_c={adc_to_celsius(adc)}“)
r = requests.post(INFLUX, data=body,
headers={“Authorization”: f"Token {TOKEN}”}, timeout=3)
if r.status_code == 204:
seen.add((src, seq))
print(“posted”, src, seq, adc, flush=True)
if len(seen) > 5000:
seen.clear()
else:
print(“Influx error”, r.status_code, r.text, flush=True)
except requests.RequestException as e:
print(“Influx unreachable:”, e, flush=True)
except Exception as e:
print(“parse error:”, e, line.strip(), flush=True)
EOF

Insert the bridge token without showing it on screen:

read -s -p "Paste the bridge token, then press Enter: " TOK; echo
sed -i “s|PUT_YOUR_NEW_TOKEN_HERE|$TOK|” ~/espnow_bridge.py
unset TOK
grep -c PUT_YOUR_NEW_TOKEN_HERE ~/espnow_bridge.py

The last line must print 0. If you run several Radxa boards into one central InfluxDB, change localhost in the INFLUX line to the central server’s IP address; the gateway= tag then shows which board each reading came from.

F2. Boot service

Do this after Part H passes, not before.

sudo tee /etc/systemd/system/espnow-bridge.service >/dev/null <<‘EOF’
[Unit]
Description=ESP-NOW mesh gateway bridge to InfluxDB
After=wlan0-monitor.service influxdb.service
Requires=wlan0-monitor.service

[Service]
Environment=PYTHONUNBUFFERED=1
WorkingDirectory=/home/radxa
ExecStart=/usr/bin/python3 /home/radxa/espnow_bridge.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable espnow-bridge.service

Part G. ESP8266 node firmware

The node sketch and MeshProtocol.h stay as you wrote them, with these changes.

It work OK with testing

radxa@radxa-cubie-a7z:~$ sudo systemctl stop espnow-bridge.service 2>/dev/null

cd ~/Linux-ESPNOW/ESPNOW_lib

sudo ./bin/mesh_gateway wlan0

gateway MAC (use this as GATEWAY_MAC in the node): BC:2A:33:96:AB:E3

mesh_gateway running on channel 11

HELLO from c4:5b:be:55:a9:5e → PROVISION id 246945573

DATA node=246945573 seq=563 adc=50 digital=1 → ACK queued

PAYLOAD [76]: c2a7515e 2517b80e 01000000 33020000 01053200 010e0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000da58

DATA node=246945573 seq=564 adc=49 digital=1 → ACK queued

PAYLOAD [76]: c2a7515e 2517b80e 01000000 34020000 01053100 01100000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000061b8