Jump to content

I recently got my network rack temp sensors working with Home Assistant and had a fun little project spawn out of it to start/stop folding on my server depending on the temperature in the rack and also time time. All of this is done on HAOS and might vary slightly depending on how you run Home Assistant

 

 

1) Run Command to Gen SSH Key:

ssh-keygen

 

2) Copy SSH Key to Remote Server:

ssh-copy-id username@192.168.x.y

 

3) Copy SSH Keys to Config Folder:

SSH Keys need to live in /config/.ssh/ instead of /root/.ssh/ for shell commands

cp /root/.ssh/id_ed25519 /config/.ssh/id_ed25519
cp /root/.ssh/id_ed25519.pub /config/.ssh/id_ed25519.pub

 

4) Create Shell Commands:

nano /config/configuration.yaml

Add in the following where you see fit, end of file is good:

shell_command:
  folding_start: ssh -i /config/.ssh/id_ed25519 -o StrictHostKeyChecking=no username@192.168.x.y 'fahctl -a 192.168.x.y fold'
  folding_stop: ssh -i /config/.ssh/id_ed25519 -o StrictHostKeyChecking=no username@192.168.x.y 'fahctl -a 192.168.x.y finish'

You might be able to get away without "-o StrictHostKeyChecking=no" but if you get Error 255 in the Logs on Home Assistant then add it in

 

5) Reload Home Assistant


6) Create automation in home assistant as needed

 

 

 

Example automation in Home Assistant:

Spoiler

image.thumb.png.041c2864c8eb82fdda4a39944dacd8d5.png

 

Current Network Layout:

Current Build Log/PC:

Storage Server Setup:

 

Prior Build Log/PC:

Link to comment
https://linustechtips.com/topic/1608719-automate-foldinghome-with-home-assistant/
Share on other sites

Link to post
Share on other sites

Additional HA automation:

Plex runs on the same VM that does folding so if folding is active and plex is transcoding, pause folding. If transcodes drop below 0 then resume folding

alias: Pause Folding - Plex Play
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.tautulli_transcodes
conditions: []
actions:
  - if:
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.folding_state
            state: "on"
          - condition: numeric_state
            entity_id: sensor.tautulli_transcodes
            above: 0
    then:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.folding_state
      - action: shell_command.folding_pause
        metadata: {}
        data: {}
  - if:
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.folding_state
            state: "off"
          - condition: numeric_state
            entity_id: sensor.tautulli_transcodes
            below: 1
    then:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.folding_state
      - action: shell_command.folding_start
        metadata: {}
        data: {}
mode: single

 

Current Network Layout:

Current Build Log/PC:

Storage Server Setup:

 

Prior Build Log/PC:

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×