Skip to content

FriendlyNGeeks/PiVAC

Repository files navigation

json API
PiVAC

An attempt to make a Low Cost "3D" printed cooling solution for raspberry pis in network racks. Powered by Raspberry Pi Zero 2W over POE.

Getting started

License: Apache 2 Discord chat Download PIVAC Awesome

json API

json API

json API

json API

Table of Contents

Getting Started

Raspberry Pi Ventilation and Air Conditioning

Inspired from the Raspberry Pi Server Mark III created by Ivan Kuleshov at UpLab and Waveshare POE Hat using an Python sample code from Adafruit. We have a "Multi-Threaded" python script that runs both; A basic json API status response server on port 80 and a fetch prometheus query for Raspberry Pi temps. Main branch had raw secrets file and no error handling and two seperate services. 2.0 fixes most of all these issues along with allowing for a remote_config or default_config fallback.

Configuration

Advise you use both the HOSTNAME and IP address for each setup as sometimes local host are unavailable the script will attempt the IP address. Add or subtract as many units to monitor as you like. The Adafruit Servo hat has more channels or if you just want temps mark fan as "null". Keep a basic fallback config in /home/pi else set "mount" path in fetechConfig.py to a remote_config.py:

  • default_config.json
# Stored in seperate file

{"data":[
    {
        "Name": "WATCHTOWER",
        "disName":"Watch",
        "Address":[
            {"URL":"http://watchtower.local:9090"},
            {"IP":"http://192.168.2.151:9090"}
            ],
        "Fan":11
    }, 
    {
        "Name": "PEONS",
        "disName":"Peons",
        "Address":[
            {"URL":"http://peons.local:9090"},
            {"IP":"http://192.168.2.158:9090"}
            ],
        "Fan":"null"
    },
    {
        "Name": "ZEROSOL",
        "disName":"0-Sol",
        "Address":[
            {"URL":"http://zerosol.local:9090"},
            {"IP":"http://192.168.2.156:9090"}
            ],
        "Fan":15
    }
]}

Auto Mount

  • automount
  sudo -s nano /etc/fstab         
  # add to bottom of file
  # network share mount
  //192.168.x.xxx/dev/RASPBERRY/PiVAC /home/pi/mnt cifs user=JANE,pass=XXXXX 0 0

Service

  • pivac.service
  # copy pivac.service file and put it in the /etc/systemd/system
  cd /etc/systemd/system
  sudo systemctl enable pivac.service
  sudo systemctl start pivac.service

Temps-Colors

  • fetchTemps.py
  def get_Color(temp, fan):
    if temp > 59:
        # set fan(x) to HIGH
        fetchFans.set_Fan_Speed(fan, 100, "HIGH")
        # temp red
        return ["#00FF00", "HIGH"]
    elif temp > 40 and temp <= 58:
        # set fan(x) to MED
        fetchFans.set_Fan_Speed(fan, 75, "MED")
        # temp yellow
        return ["#FFFF00", "MED"]
    else:
        # set fan(x) to LOW
        fetchFans.set_Fan_Speed(fan, 35, "LOW")
        # temp green
        return ["#00FF00", "LOW"]

About

Raspberry Pi Ventilation and Air Conditioning

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages