MapleCUN Proxy: Use your MapleCUN for multiple systems. No Stackable implementation required
603
This proxy was developed to use the radio module of a MapleCUN (using a-culfw) with software that is not cabable of using "stackable" CULs. The proxy splits all the modules into one http port each.
Usually a MapleCUN with a-culfw uses multiplexing with asterisk prefixes (*, **, etc.) on a single TCP port. This hides this logic: Each of the modules will get a dedicated TCP port. Applications like Home Assistant, wmbusmeters, Homegear oder FHEM can be configured to use a single port with knowing about stackable CULs. It just looks like 4 different devices (but on a single IP).
All devices will see the responses of the radio modules. If there are three clients connected to radio1, all clients will see the responses of this specific radio module.
amd64, arm64 (Pi 4/5). Unfortunately arm/v7 (Pi 2/3) is not supported due to their age.The proxy handles sending the astrisk in both direction hiding the logic from the actual clients (Send/Receive):
| Local port | Module | Prefix (Send) | Prefix-Removal (Response) |
|---|---|---|---|
| 1080 | Module 1 | No Prefix | No change |
| 1081 | Module 2 | * | First asterisk removed |
| 1082 | Module 3 | ** | First two asterisks removed |
| 1083 | Module 4 | *** | First three asterisks removed |
Settings are done purely in environment variables:
| Variable | Description | Default |
|---|---|---|
MAPLECUN_IP | IP-address of MapleCUN hardware | 192.168.0.1 |
MAPLECUN_PORT | Network-Port of MapleCUN hardware | 2323 |
DEBUG | Debug logging of input/output as true or false | false |
LOG_FORMAT | dateformat for logging (Java time format) | yyyy-MM-dd HH:mm:ss |
RECONNECT_TIMEOUT | when connection to MapleCul is los reconnect in seconds | 5 |
Create a docker-compose.yaml with the following defaults or use the one from the repo:
services:
maplecun-splitproxy:
image: boriswde/maplecun-splitproxy:latest
container_name: maplecun-splitproxy
restart: unless-stopped
ports:
- "1080:1080" # Module 1
- "1081:1081" # Module 2
- "1082:1082" # Module 3
- "1083:1083" # Module 4
environment:
- MAPLECUN_IP=192.168.178.50
- MAPLECUN_PORT=2323
- DEBUG=true
- TIMELOG_FORMAT=yyyy-MM-dd HH:mm:ss
- RECONNECT_TIMEOUT=5
If you would like to use wmbusmeters Wireless M-Bus, please note that you need to use socat for a serial port. In case of a docker-compose.yaml, you can do something like this. This will fix the errournous initialization of wmbusmeters and also make sure that it is reset every 30 seconds.
services:
wmbusmeters:
container_name: wmbusmeters
image: wmbusmeters/wmbusmeters
stop_grace_period: 10m
volumes:
- /your_local_storage/wmbusmeters:/wmbusmeters_data
- /etc/localtime:/etc/localtime:ro
command: >
sh -c "
apk add --no-cache socat &&
socat -d -d pty,raw,echo=0,link=/dev/ttyUSB-bridge,mode=777 TCP:hass_maplecun-splitproxy:1082,forever,interval=2,retry=30 &
echo 'waiting for TCP CUL…' &&
while [ ! -e /dev/ttyUSB-bridge ]; do sleep 0.2; done &&
(
while true; do
sleep 30;
echo 'X21' > /dev/ttyUSB-bridge;
echo 'brt' > /dev/ttyUSB-bridge;
sleep 3600;
done
) &
sh /wmbusmeters/docker-entrypoint.sh
"
In homematicbidcos.conf for module 1:
deviceAddress = IP_OF_MAPLECULPROXY:1080
javac MapleCunSplitProxy.java
java MapleCunSplitProxy
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
-t boriswde/maplecun-splitproxy:latest \
--push .
Content type
Image
Digest
sha256:bd44332f8…
Size
174.8 MB
Last updated
4 months ago
docker pull boriswde/maplecun-splitproxy