Schnitzel / hass-miner

Controll your Bitcoin miner from Home Assistant
MIT License
59 stars 19 forks source link

Miner Love Core A1 Pro 26T #356

Open TimFrandsen opened 6 months ago

TimFrandsen commented 6 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here. Is it possible to get the? Love Core A1 Pro 26T miner under the list of supported minor please I would like to use a product in my home assistance. I would mine With the power for my son panel, I didn't use myself please and thank you.

b-rowan commented 6 months ago

I can give it a shot, but without knowing what exactly it has for web APIs and such this is going to be quite difficult.

Can you send the result of this script on windows? If you don't have a windows machine I can translate this to bash, but most people do.

To use this, make a new text file, paste this data in, and change the "server" variable at the top to match the IP of your miner. Once that's done, change the file extension of the file to .ps1 (if you cant see this, its in file explore top menu, view, then a checkbox that says file name extensions, then you can rename the file). Right click, select "Run with powershell", then send the result in a text file here.

$server = "192.168.1.5"
$port = 4028
$commands = @("devs", "stats", "devdetails", "version")

try {
    foreach ($cmd in $commands) {
        $client = New-Object System.Net.Sockets.TcpClient
        $client.Connect($server, $port)

        $stream = $client.GetStream()

        $command = '{"command": "' + $cmd + '"}'
        $writer = [System.Text.Encoding]::UTF8.GetBytes($command)

        $stream.Write($writer, 0, $writer.Length)
        $stream.Flush()

        # Read response
        $reader = New-Object System.IO.StreamReader($stream)
        $response = $reader.ReadToEnd()
        $reader.Close()

        # Display the response
        Write-Host "Response for command '$cmd':"
        Write-Host "-------------------------------------------------------------------------------------"
        Write-Host $response
        Write-Host ""

        # Clear the stream for the next command
        $stream.Flush()
        # Close the connection
        $client.Close()
    }

    # Wait for a key press
    Read-Host "Press Enter to exit..."
}
catch {
    Write-Host "An error occurred: $_"
    Read-Host "Press Enter to exit..."
}