Knowledge Base EDL21

Knowledge Base: Migrating EDL21 USB Readers to NanoPi Neo Plus 2 via ser2net

This document describes the stable migration of two USB smart meter readers from a Synology NAS (Home Assistant VM) to a dedicated NanoPi Neo Plus 2 for network forwarding via ser2net, ensuring no loss of historical data.

Created with the support of Manus AI – your autonomous AI agent.

1. Resources & Preparation

To ensure stability of USB drivers and reboot behavior, a specific Armbian version must be used.

Procedure:

  1. Download the image and flash it to a microSD card using balenaEtcher.
  2. Insert the card into the NanoPi, boot it, and connect via SSH (root).
  3. Set a password, but do not run apt upgrade to keep the stable kernel.

2. System Configuration (Terminal)

Execute these commands sequentially.

A. Update Package Sources & Installation

Since Debian Buster is “End-of-Life,” package sources must be redirected to the archive servers:

# Quellen auf Archiv umstellen
sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list
sed -i 's/security.debian.org/archive.debian.org/g' /etc/apt/sources.list
sed -i '/buster-updates/d' /etc/apt/sources.list

# Installation
apt update
apt install ser2net -y

B. Persistent USB Assignment (udev Rules)

To ensure the meters keep the same name after every reboot, we use the physical USB path:

echo 'SUBSYSTEM=="tty", ENV{ID_PATH}=="platform-1c1d400.usb-usb-0:1:1.0", SYMLINK+="stromzaehler_lichtstrom"
SUBSYSTEM=="tty", ENV{ID_PATH}=="platform-1c1a400.usb-usb-0:1:1.0", SYMLINK+="stromzaehler_waermepumpe"' > /etc/udev/rules.d/99-stromzaehler.rules

udevadm control --reload-rules && udevadm trigger

C. ser2net Configuration (Version 3.5)

Configure network ports 2001 and 2002 for forwarding:

echo "2001:raw:0:/dev/stromzaehler_lichtstrom:9600 8DATABITS NONE 1STOPBIT
2002:raw:0:/dev/stromzaehler_waermepumpe:9600 8DATABITS NONE 1STOPBIT" > /etc/ser2net.conf

systemctl enable ser2net
systemctl restart ser2net

3. Home Assistant Integration

In Home Assistant, the meters are integrated as network devices. This preserves the history as entity IDs can be maintained.

Steps:

  1. Navigate to SettingsDevices & Services.
  2. Add Integration → Search for EDL21.
  3. Select connection type Network.
  4. Enter Host/Path:
  • Meter 1 (Lichtstrom): socket://:2001
  • Meter 2 (Wärmepumpe): socket://:2002
  1. History Check: Verify in the Energy Dashboard that the data seamlessly continues from the old records.

4. Fail-Safety (Optional)

To protect the system against freezes, the hardware watchdog can be activated:

apt install watchdog -y

sed -i ‘s/#watchdog-device/watchdog-device/g’ /etc/watchdog.conf

systemctl enable watchdog

systemctl start watchdog

Note: After successful setup, create a 1:1 image backup of your microSD card using tools like “Win32 Disk Imager” to be immediately ready in case of hardware failure.