A Home Assistant custom integration for monitoring and controlling Folding@home v8.x clients via their local WebSocket API.
- Real-time monitoring via WebSocket push updates
- Status sensor - Shows current state (folding, paused, finishing)
- Points Per Day (PPD) sensor - Track your contribution
- Active CPUs sensor - Monitor resource usage
- Work Units sensor - Track active work units with progress details
- Folding switch - Pause/resume folding
- Finish & Pause button - Complete current work units then pause
- Home Assistant 2024.1.0 or newer
- Folding@home v8.x client (codename "Bastet")
- Network access to the FAH client's WebSocket API (default port 7396)
- Open HACS in Home Assistant
- Click the three dots menu and select "Custom repositories"
- Add this repository URL with category "Integration"
- Search for "Folding@home v8" and install
- Restart Home Assistant
- Download the
custom_components/foldingathomefolder from this repository - Copy it to your Home Assistant
config/custom_components/directory - Restart Home Assistant
Ensure your Folding@home client allows connections from Home Assistant:
# Linux: Start with network access flags
fah-client --allow='127.0.0.1 192.168.0.0/24' --deny=0/0 --http-addresses=0.0.0.0:7396Or edit /etc/fah-client/config.xml to include appropriate allow/deny rules.
- Go to Settings > Devices & Services
- Click Add Integration
- Search for "Folding@home"
- Enter your FAH client's hostname/IP and port (default: 7396)
| Entity | Description |
|---|---|
| Status | Current state: folding, paused, or finishing |
| Points Per Day | Total PPD across all work units |
| Active CPUs | Number of CPUs allocated to folding |
| Work Units | Number of active work units (with details in attributes) |
| Entity | Description |
|---|---|
| Folding (switch) | Toggle to pause/resume folding |
| Finish & Pause (button) | Complete current work units then pause |
automation:
- alias: "Pause FAH during peak hours"
trigger:
- platform: time
at: "17:00:00"
action:
- service: switch.turn_off
target:
entity_id: switch.servername_folding
- alias: "Resume FAH after peak hours"
trigger:
- platform: time
at: "22:00:00"
action:
- service: switch.turn_on
target:
entity_id: switch.servername_foldingautomation:
- alias: "Notify high PPD"
trigger:
- platform: numeric_state
entity_id: sensor.servername_ppd
above: 1000000
action:
- service: notify.mobile_app
data:
message: "FAH PPD exceeded 1 million!"- Verify the FAH client is running:
systemctl status fah-client - Check the client is listening on the expected port:
netstat -tlnp | grep 7396 - Ensure firewall allows connections from Home Assistant
- Verify the client's
--allowconfiguration includes Home Assistant's IP
The integration automatically reconnects on connection loss. If issues persist:
- Check network stability between Home Assistant and FAH client
- Review Home Assistant logs for specific error messages
- Ensure the FAH client isn't being restarted frequently
import asyncio
import aiohttp
import json
async def test():
async with aiohttp.ClientSession() as session:
async with session.ws_connect('ws://localhost:7396/api/websocket') as ws:
async for msg in ws:
if msg.type == aiohttp.WSMsgType.TEXT:
if msg.data != "ping":
print(json.dumps(json.loads(msg.data), indent=2))
break
asyncio.run(test())This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
- Folding@home for their distributed computing platform
- fah-client-bastet for the v8 client