Introduction: Heat Your Home and Help Cancer Research With Folding@home + Home Assistant
With winter in full effect i've been freezing my hands off while working at my computer. After looking for and giving up on trying to find a compact, non-plasticy and somewhat cheap spacer heater i decided to use the space heater I already had - my computer.
While I could use some basic benchmarking program to constantly keep my computer busy I decided to do something good with all that compute power - the wonderful folding@home.
Folding@home is an application that runs on your computer and helps with disease research by simulation protein folding, computational drug design, and other types of molecular dynamics.
The Folding@home network has a speed of 98,7 petaFLOPS - making it one of the worlds fastest computing systems.
You can read more about folding at home here.
Supplies
- Decent computer running Windows, Linux or MacOS
- Home-assistant instance on your network
- Temperature sensor connected to your Home assistant
Step 1: Making a Few Changes to Our Network
To make sure that our folding computer and our Home assistant computer/pi can talk to eachother we need to give them both static ip-addresses.
This is easiest to do via your router. How to set a static ip in the router software is different from router to router, try googling "router product name + static ip".
You may also set a static ip in windows, see this guide.
Step 2: Getting Started With Folding@Home
First things first, lets get Folding@home setup on our computer.
The official installation guides are great so I wont repeat them here, you can find the instruction here.
Weather you setup an identify or not does not mater for this guide, although I definitely recommend that you do.
- Open FAHcontrol by right-clicking the folding@home icon in the system tray and click Advanced Control.
- Click the Configure button at the top.
- Go to the Remote Access tab.
- In the "Allow" text-boxes under Ip address restriction and Passwordless IP Adress Restriction, change "127.0.0.1" to "127.0.0.1 {{HA IP}}" (without the quotation marks) where {{HA IP}}" is the ip of your Home assistant device. Make sure you keep the space between 127.0.0.1 and your Home assistant ip.
- Click Save and restart folding at home by right-clicking as above and clicking "Quit".
- Start Folding@home again.
Step 3: Configuring Home Assistant
With Folding@home up-and-running its time to turn this piece of software into a smart radiator.
Open up you Home assistant's configuration.yaml and paste the following code:
switch:
platform: telnet switches: folding: name: "Folding@Home" resource: {{Computer IP}} port: 36330 command_on: "unpause" command_off: "pause" command_state: "slot-info" value_template: '{{ value|regex_search("RUNNING", ignorecase=FALSE) }}' timeout: 0.9
Replace {{Computer IP}} with the ip of the computer running folding@home.
You may also give the switch another name, simply replace "Folding@Home" with whatever name you wish.
If you wish to simply have a smart-home switch for your folding@home instance you are done here.
Next we will create the thermostat that will automatically turn on/off folding@home depending on the temperature in the room. We will use the generic_thermostat platform included in Home assistant.
Add this to the configuration.yaml as well:
<p>climate:<br> - platform: generic_thermostat name: folding_heater heater: switch.folding target_sensor: sensor.room_temperature min_cycle_duration: 00:40:00</p>
where sensor.room_temperature is the name of your rooms temperature sensor.
With this pasted, save the file and restart Home assistant.
Step 4: Finishing Up
With everything up-and-running, it's time to add the thermostat to our Home assistant frontend.
- Head over to the frontend and click the three dots at the top right and then Configure UI.
- Click the floating plus in the bottom right and select thermostat from the list.
- Select the entity, folding_heater unless you renamed it.
Thats it!
Simply select your desired temperature and let Home assistant do the work!