rem ###########Change These Bits below###################### set dockerName=givtcp_auto set dockerPort=6345 set range=192.168.1 rem ####################################################### rem - ::::::::Do not Change anything below this line::::::::: :Find rem sets directory to wherever batch file is setlocal cd /d %~dp0 rem Sets MAC to search for set GivMac=34-ea-e7 @echo off cls Echo Step 1: Givenergy Auto Discover REM runs arp command and stores table into text file (not needed to make auto dicsocvery work, just handy to see) arp -a >NetworkIPList.txt Echo Full Network List Saved to File "IPList.txt" Timeout 10 REM Same as above above searches table for first 3 MAC identifiers & spits out related IP if found (errors if no MAC found) SETLOCAL ENABLEDELAYEDEXPANSION FOR /f "tokens=1,2" %%a in ('arp -a ^| findstr /i %GivMac%') do ( @echo IP: %%a MAC: %%b SET "InvIP=%%a" SET "InvMAC=%%b" cls GOTO :Found ) Rem goes to error section if not found. Goto :Failed :Found cls echo Step 2: DEVICES FOUND echo Givenergy Inverter %InvMAC% found with IP Address of: %InvIP% timeout 10 :DockerPull Echo. Echo Step 3: Pull Latest Version from Docker (Must have docker installed first!) set "reply=y" set /p "reply=Pull Latest GivTCP Docker Image? [y|n]: " if /i not "%reply%" == "y" goto :startDocker docker pull britkat/giv_tcp-ma Timeout 10 :startDocker Echo. Echo "Step 4: Start Docker with found Serial & IP address" set "reply=y" set /p "reply=Start Docker Image with found Inverter IP? [y|n]: " if /i not "%reply%" == "y" goto :end docker run --name %dockerName% -d -p %dockerPort%:%dockerPort% -e INVERTOR_IP=%InvIP% britkat/giv_tcp-ma Echo. Echo Waiting for Docker to Start then opening default data page. Timeout 5 start "Givenergy" "http://127.0.0.1:%dockerPort%/runAll" Timeout 10 Exit :end Echo. Echo Setup Cancelled. Exit in 10... Timeout 10 Exit :Failed Echo. Echo No Inverter Found in ARP Table with correct MAC on Network set "reply=y" set /p "reply=Attempt to ping all devices on netwok? (Will take a while...) [y|n]: " if /i not "%reply%" == "y" goto :Error for /l %%i in (1,1,254) do ping -n 1 %range%.%%i set "reply=y" set /p "reply=Attempt to find inverter again? [y|n]: " if /i not "%reply%" == "y" goto :end goto :Find :Error Echo. Echo No Inverter Found with correct MAC on Network Timeout 30 Exit