We apologize but our blog is available only in English, Spanish and Russian.
Bitcoin Mining Insights

Automated Control Of Home Temperature With Mining Heat Exhaust

A guide to using an open-source software tool for easy control of bitcoin mining hardware running Braiins OS+

Published on May 31, 2022
START READING
Published on May 31, 2022

Table of Contents

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.

External Temperature Management

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. 

What Is 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.

Installing Home Assistant

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.

Installing Home Assistant Community Store (HACS)

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 Miner Integration in HACS

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:

Connecting Mining Machines 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.

Controlling Hardware With Home Assistant

There are currently two settings miners can control from Home Assistant:

  • Turning the machine on and off
  • Controlling the power limit (the same settings as under Performance > “PSU Power Limit” in the Braiins OS+ interface)

The miner integration will also load the following data and show it as sensors in Home Assistant:

  • Current Hashrate in TH/s
  • Power Consumption in Watts
  • Chip Temperature in Celsius or Fahrenheit
  • Scaled Power Limit in Watts (this shows if the Miner has a lower power limit because of the Dynamic Power Scaling feature)

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. 

Home Heating With Bitcoin Mining

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:

  1. A simple Wifi enabled sensor: Shelly H&T Humidity and Temperature Wireless Smart Sensor and the Shelly integration in Home Assistant 
  2. Build your own with an ESP8266 and DHT22 for $6 

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.

That’s it!

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.

Update Miner Integration in Home Assistant

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.

Conclusion

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.

You can view the changelog also in our documentation.
See the full changelog
No items found.

Get notified when we release new update

By subscribing you are agreeing to our Privacy Policy
Wohoo! You're subscribed, we'll be in touch soon.
Something went wrong. Please try again.
Share now

About Braiins

Bitcoin mining software company: Braiins Pool, Braiins OS+ & Stratum V2.

By miners, for miners.

Still scrolling?
Keep reading!