From 94c9a7b28f91d9aafbe6c11aff75fa7d2e0e2ba3 Mon Sep 17 00:00:00 2001 From: atef Date: Fri, 10 Apr 2026 15:23:09 +0200 Subject: [PATCH] Create a tunnel script to connect different device on the kaco installation --- csharp/App/KacoCommunication/tunnelSalimax.sh | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 csharp/App/KacoCommunication/tunnelSalimax.sh diff --git a/csharp/App/KacoCommunication/tunnelSalimax.sh b/csharp/App/KacoCommunication/tunnelSalimax.sh new file mode 100755 index 000000000..8a6323ce0 --- /dev/null +++ b/csharp/App/KacoCommunication/tunnelSalimax.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +host="ie-entwicklung@$1" + +tunnel() { + name=$1 + ip=$2 + rPort=$3 + lPort=$4 + + echo -n "$name @ $ip mapped to localhost:$lPort " + ssh -nNTL "$lPort:$ip:$rPort" "$host" 2> /dev/null & + + until nc -vz 127.0.0.1 $lPort 2> /dev/null + do + echo -n . + sleep 0.5 + done + + echo "ok" +} + +echo "" + +tunnel "Trumpf DCDC (http) " 10.0.2.1 80 8002 +tunnel "Kaco Inverter (http) " 10.0.3.1 80 8003 +tunnel "Int Emu Meter (http) " 10.0.4.2 80 8004 + +echo +echo "press any key to close the tunnels ..." +read -r -n 1 -s +kill $(jobs -p) +echo "done" +