A guide to using an open-source software tool for easy control of bitcoin mining hardware running Braiins OS+
Mining bitcoin at home is a multi-faceted endeavor. Some miners run their machines outside at full power all the time, while others are using their miners to heat a house, a pool or they use excessive energy from a solar system to mine. But all of these approaches introduce various complications with managing heat, power consumption, and efficiency.
This article explains some of the difficulties with controlling external temperature from mining heat exhaust and an effective tool for managing temperature with detailed installation instructions.
Even though Braiins OS+ already supports temperature based Dynamic Power Scaling, this scaling is dependent on the temperature of the chips and not the temperature of the house heated by the miner. For a comfortable temperature, an external system is also needed that measures the temperature of the house and tells the miner to turn on when it’s too cool or turn off when it’s too warm. The same is true for an excess energy consumption system like with solar panels, the miner doesn’t know when the sun is shining and there is excess energy to be mined. Some use cases like water heaters might want to not only turn the miner on and off, full control of the amount of watts the miner consumes is critical, as they want to keep the water in a water heater at a specific temperature, which is best achieved by running the miners at a lower power setting.
Many approaches by the community have tried to solve this problem. Some of these include turning miners on and off with relay systems or presetting power consumption settings in Braiins based on an average sun shining data. None of these methods really were fully satisfactory though. And while Braiins has the BOSminer API that can be used to control the miner from another system, most home miners don’t have the experience to program a control system themselves, plus connecting to existing house control systems like a Nest thermostat can be quite complex. So, this author decided to look for an already existing ecosystem of home automation to make this connection simpler, and as a result discovered Home Assistant.
Home Assistant is a free and open-source software for home automation designed to be a central control system for smart home devices with a focus on local control and privacy. There are already thousands of integrations with sensors, lights, heating systems and many more, plus the fact that it’s by default not cloud enabled will make it possible to use it in even the most remote or secure citadels.
Starting today, a home miner can control their machine(s) running Braiins OS+ from Home Assistant. Control features include turning it on and off, configuring the power limit, and monitoring all sorts of performance data from your machine inside of Home Assistant (e.g., energy use).
The following sections provide step-by-step instructions for installing the miner integration in an existing home assistant installation to start using mining hardware for heating a residence and effectively managing the home temperature.
The installation of Home Assistant is already perfectly covered by the Home Assistant community: https://www.home-assistant.io/installation/. This author runs his Home Assistant on a Raspberry Pi 4. A new user should opt for whatever hardware they are most comfortable with.
The following sections give step-by-step installation instructions. Also, the embedded video below explains the installation process.
Miners will need to download the Home Assistant Community Store (HACS), which offers a powerful UI for managing the downloads of custom software for the Home Assistant. Currently the miner control integration for Home Assistant is a custom_component. Custom components are a bit easier to develop than regular components of Home Assistant. The current version of the miner integration is still quite Beta, when we reach a more stable solution we will definitely propose the miner integration to Home Assistant Core.
There is the official installation documentation of HACS here
If this seems to be a bit complex, follow along the installation of HACS in this video.
Installing the actual miner integration involves adding a custom repository into HACS, which includes all the code needed to communicate with mining machines running Braiins OS+.
Visit HACS on your Home Assistant.
Click on Integrations.
Click on top right menu item and select “Custom Repositories".
Enter “https://github.com/Schnitzel/hass-miner” under Repository, select “Integration” as Category and click Add.
Close the Custom Repositories window and select “Explore & Download Repositories”.
Search for “miner” in the search bar and select “miner”.
Select “Download this repository with HACS”.
HACS will automatically select the newest Version, click “Download”.
HACS will show now a new Integration “miner” and say that there is a pending restart.
Go to Settings -> System and click “Restart” on the top right.
Congratulations! The miner integration with Home Assistant is now installed. The next step is to connect the first mining machine to Home Assistant:
Important Note: The miner integration depends on being able to connect via SSH to the miner. If this doesn’t work, a home miner won’t be able to set the power limit for their machines and will only be able to turn it on and off.
As the SSH connection requires a username and password authentication the miner integration currently supports the two most used configurations of username and password: “root/admin”, “admin/admin” and “root/root”. Currently it’s not possible to configure a custom username and password (but this is definitely planned for the future).
Each machine that needs configuration via Home Assistant needs to be added with the following steps.
Visit Settings -> Devices & Services and click on “Add Integration” at the bottom right.
Search for “miner” and select the “Miner” Integration. If “Miner” can't be found in the list, try to hard refresh your browser (press control or shift key and reload button) and try again.
Enter the IP address of the machine that will connect to Home Assistant.
The miner integration will connect to the miner and get its hostname and suggest it automatically.
To use another hostname, change it in the next step.
If everything worked correctly, the miner configuration is created and Home Assistant shows the Device Type (in this example an Antminer S9). Users can assign the machine to a specific area in their Home Assistant setup, but this is not required. Click Finish.
After everything is done, the display should show a new Integration with the user’s chosen hostname on the integration list:
Congratulations again! Now mining machines can be controlled from the from Home Assistant.
The next section explains exactly how to control them.
There are currently two settings miners can control from Home Assistant:
The miner integration will also load the following data and show it as sensors in Home Assistant:
All this data can easiest be seen with going to Settings > Integrations and click on a device.
Here, Home Assistant will show a nice overview of the current status of the machine.
Users can directly turn on or off their machine and change the power limit setting through the “Controls” panel. The Sensors show you the status of the miner which is updated every 10 seconds.
Please keep in mind that whenever a setting like the power limit changes, the sensors and controls might shortly be deactivated. This is because after something changes, the miner integration will talk to the miner, change the configuration and based on what was changed (e.g., a change to the power limit), and cause the mining process to restart. During this time the integration won’t be able to talk to the miner and maybe shows the controls grayed out, normally this is only for a couple of seconds, and they should come back momentarily.
Of course, users can add as many machines as they want! Just add another “miner” integration and add the IP of the second miner.
From here, the sky is the limit. Miners can add the sensors and controls to their own Home Assistant dashboards, create their own automations, or make their machines part of complex scripts. It really depends on what a user is trying to achieve with their mining hardware. The following section offers an example of using Home Assistant.
Now that a home miner can fully remote control their machines, it’s not very hard to also start controlling room or house temperature with the same mining hardware.
This section provides an example of how to control the temperature of a room with mining hardware, but the limits to these sorts of use cases are only the miner’s imagination! Visit the examples page of Home Assistant for more inspiration.
First, a miner needs the temperature sensor in their Home Assistant. For this, there are many different solutions, and if a user already has a smart thermostat, they can possbly connect it via one of the many integrations to their Home Assistant. (Ask Google!)
To start with something new, this author suggests two temperature sensors:
After adding a temperature sensor in Home Assistant, start to set up the Automation for it.
For now, start with a super simple system. If the temperature is below a specific value, set the mining machine to turn on. If the temperature is above a specific value, set the machine to turn off. This can be built in Home Assistant with two automations.
Go to Settings > Automations.
Click on Create Automation Button, and select “Start with empty automation”.
Give the Automation a descriptive name. Add as Trigger the room temperature sensor and set it to Above: 70 (or whatever temperature is preferred). Select the Miner under Actions and set it to “turn off”.
Repeat the same step, and set a temperature for when the machine should be turned on.
Congratulations on building a house heating system with mining hardware. The automations overview page shows when the automations have triggered last.
Of course, this is a super simple setup. Home miners might want to have a bit more control over the system. For example, a user might want to set the target temperature from their phone, or have another temperature during the night. There are many different ways to do this in Home Assistant. Check out the video about the Generic Thermostat Control of Awesome Open Source on how to do this.
The miner integration in Home Assistant is constantly updated and improved, therefore users will want their integration up to date.
HACS will automatically check if there is a new version of the miner integration existing. Any updates will be shown in the HACS overview.
Click on the update and install the update.
After the update, users need to restart Home Assistant. Go to Settings -> System and click “Restart” on the top right.
To force a check for an update, go to the HACS overview.
That’s it! Congratulations on completing all of the above instructions. Hopefully this guide can help hundreds and thousands of at-home miners effectively manage one of the most important outputs from mining (besides the actual sats): the heat. If this article was helpful, feel free to mention or message the author on Twitter with comments or questions. Happy mining and heat management!
This article was written for the Braiins blog by Michael Schmid. Michael is a home miner, bitcoiner and general tinkerer. Follow Michael on Twitter.
Bitcoin mining software company: Braiins Pool, Braiins OS+ & Stratum V2.
By miners, for miners.
Increase hashrate on your Bitcoin ASICs, improve efficiency as much as 25%, and mine on any pool or get 0% pool fees on Braiins Pool.
Reduce data transmission between your farm and pool by 95%. Configure parallel usage of multiple pools. Set a backup pool for the whole farm.
It focuses on making data transfers more efficient, reducing physical infrastructure requirements for mining operations, and increasing security
Industry leaders in transparency and innovation, with more than 1.25 million BTC mined since 2010.