Sleepy Pi WiFi

I have two Raspberry Pi(s) in my home. One is running our wireless printer server using CUPS and the other is acting as an airplay node for our stereo using shairport.

The problem I was having was they would be working fine until they sat idle for awhile and then they'd fall off the network. After researching I found it has to do with WiFi chipset and power management.

TL;DR;

cat /sys/module/8192cu/parameters/rtw_power_mgnt

if 1 or 2

sudo vi /etc/modprobe.d/8192cu.conf

and add

# Disable power management
options 8192cu rtw_power_mgnt=0