Here are a couple of easy ways for your server to check if other devices are using it:
- Check the arp cache using
/usr/sbin/arp or by reading
/proc/net/arp. You'll see in there all the devices which the server has communicated with fairly recently. This includes the MAC address, so you can find your phone, etc. even in the face of DHCP.
- Use ping (or arping, which won't be blocked by host-based firewalls) to actively poll your hosts.
- Set up iptables rules to match the hosts you're interested in, then check their packet counters. If the counters are increasing, those hosts are active.
All of those are doable with fairly simple scripting. You can then have the script put your server in S3, S4, or even G2/S5 and let Wake-on-LAN wake the server back up.
NOTE: On a lot of desktop boards, S3 doesn't actually save that much power. Meter it before you bother. Or make sure to use at least S4.