This has been a talking point on this forum for as long as I have been here, many of us have set power point timers to turn on/off miners based on peak rates but I have now set my miners to change power modes using LuxOS based on set times. You need the batch tool CLI, Luxos installed on your miner, excel and Autoit. At the end I will post 2 codes, the first one will be one you can click run and it will run immediately for testing, the second one will be a scheduled timer that runs on a loop.
First thing is once you have the batch tool you need to run a code that looks like this in command prompt
C:\Users\Jason\Desktop\Luxos\luxminer-cliDemo scan range 192.168.1.2 192.168.1.255 --output C:\Users\Jason\Desktop\Luxos\miners.csv (This is from my PC)
The path that you see that says Luxos/luxminer-cliDemo that is where you must have the batch file, so in that, change the path file to where ever you have saved that file. Then where it says output, thats where it will create and save the excel file with all the info you need. So you can see I just set it to save as an excel document called miners in that path on my computer.
Keep this in mind in some of the code below, you will have to change a few things to suit your path location.
For the profiles you want to change to with voltages and frequencies take note of what it says in column E,F and G. the miner I want to change is in row 3 so it changes it for that miner in E3, F3 and G3. Youβll see this in the code below, change it to what ever miner in the sheet you are trying to change. the Voltage for everything is very unique. For example it is not 13.8v, it is 13.803653 (For J pro) and if you just type 13.8v it will not work. to get the correct number you need to first change the profile on the Luxos interface to what you want, then once it has fully ramped up run the IP scanner in cmd as above to save all the data to an excel sheet and then write those numbers down. Then once you have the profile information you want to change it between you can use the code below. Please remember to set everything appropriately, my miner is a 104T J pro in this example and all miners are different and if you do not put in the correct details to suit your miner you will damage your miner.
This first code is to test changing the J pro to run 120T
; Wait for 30 seconds at the start
Sleep(3000)
; Open Excel with the file - Adjust path as needed
Local $sFilePath = βC:\Users\Jason\Desktop\Luxos\miners.csvβ
ShellExecute($sFilePath)
Sleep(9000) ; Wait for Excel to open
; Force Excel to be the active window
Local $hExcelWnd = WinWait(β[CLASS:XLMAIN]β, ββ, 10) ; Wait up to 10 seconds for Excel to be detectable
If $hExcelWnd Then
WinActivate($hExcelWnd)
WinWaitActive($hExcelWnd)
EndIf
; Assuming Excel is now the active window, simulate keystrokes to navigate and edit
Send(β{F5}β) ; Open the βGo Toβ dialog
Sleep(5000)
Send(βE3{ENTER}β) ; Navigate to E3
Sleep(5000)
Send(β645MHz{TAB}β) ; Enter value in E3 and move to F3
Sleep(5000)
Send(β13.803653{TAB}β) ; Enter value in F3 and move to G3
Sleep(5000)
Send(β645β) ; Enter value in G3
Sleep(5000) ; Wait for 5 seconds
; Save the document
Send(β^sβ) ; Ctrl + S to save
Sleep(10000) ; Wait a bit for the document to save
; Close Excel - Adjust based on your Excel version and window title
WinClose($hExcelWnd)
; Now, open cmd and execute the command
Run(βcmd.exeβ)
Local $hCmdWnd = WinWait(βC:\Windows\system32\cmd.exeβ, ββ, 10) ; Ensure cmd window is active
If $hCmdWnd Then
WinActivate($hCmdWnd)
WinWaitActive($hCmdWnd)
EndIf
; Maximize cmd window
WinSetState($hCmdWnd, ββ, @SW_MAXIMIZE)
; Type the command to execute, adjust path and command as necessary
Send(βC:\Users\Jason\Desktop\Luxos\luxminer-cliDemo config write voltage frequency --input C:\Users\Jason\Desktop\Luxos\miners.csv{ENTER}β)
Sleep(5000) ; Wait for the command to be executed
; Confirm the command if needed
Send(βyes{ENTER}β)
Sleep(5000) ; Ensure command is fully executed before closing cmd
; Close the cmd window
Send(βexit{ENTER}β)
Then this code changes profiles at 12am, 6am, 9am and 4pm on a loop.
While 1 ; This will start an infinite loop
; Check the time and execute tasks based on the current hour
Local $sCurrentTime = @HOUR & ":" & @MIN
Select
Case $sCurrentTime = "00:00"
EditAndRun("645MHz", "13.803653", "645")
Case $sCurrentTime = "06:00"
EditAndRun("145MHz", "12.000308", "145")
Case $sCurrentTime = "09:00"
EditAndRun("645MHz", "13.803653", "645")
Case $sCurrentTime = "16:00"
EditAndRun("145MHz", "12.000308", "145")
EndSelect
Sleep(1000) ; Wait for 1 second before checking the time again
WEnd
Func EditAndRun($frequency, $voltage, $g3Value)
; Open the Excel file
ShellExecute(βC:\Users\Jason\Desktop\Luxos\miners.csvβ)
Sleep(3000) ; Wait for 3 seconds for the file to open
; Force Excel to be the active window
Local $hExcel = WinWait("[CLASS:XLMAIN]", "", 10)
If $hExcel Then
WinActivate($hExcel)
WinWaitActive($hExcel)
EndIf
; Assuming use of Send to simulate keystrokes for editing values in Excel
Send("{F5}") ; Open the "Go To" dialog
Sleep(5000)
Send("E3{ENTER}") ; Navigate to E3
Sleep(5000)
Send($frequency & "{TAB}") ; Enter value in E3 and move to F3
Sleep(5000)
Send($voltage & "{TAB}") ; Enter value in F3 and move to G3
Sleep(5000)
Send($g3Value) ; Enter value in G3
Sleep(5000) ; Wait for 5 seconds
; Save the document
Send("^s")
Sleep(10000) ; Wait a bit for the document to save
; Close Excel
Send("^q")
Sleep(5000) ; Wait for Excel to close
; Open cmd and run the command
Run("cmd.exe")
Sleep(5000) ; Wait for cmd to open
; Force cmd to be the active window
Local $hCmd = WinWait("C:\Windows\system32\cmd.exe", "", 10)
If $hCmd Then
WinActivate($hCmd)
WinWaitActive($hCmd)
EndIf
Send("C:\Users\Jason\Desktop\Luxos\luxminer-cliDemo config write voltage frequency --input C:\Users\Jason\Desktop\Luxos\miners.csv{ENTER}")
Sleep(5000) ; Wait for command to execute
Send("yes{ENTER}")
Sleep(5000) ; Ensure command is fully executed before closing cmd
Send("exit{ENTER}")
EndFunc
Any questions I will answer tomorrow. Or you can copy the code into chat gpt and ask for step by step instructions on how to use the code if you have no idea