Managing PoE WiFi Access Points Power State Based On Alarm System Status

It has been almost 5 years of automating our house and during that time most systems have been automated successfully. These days it is about fine tuning and this is what this post is about.

Our house is on the largish side and contains three Cisco Aironet AP’s to provide a unified hidden SSID. We leverage our alarm system (Inner Range Integriti) extensively so our PLC (Homevision Pro) can make decisions to control power, security, lighting, audio and so on.

So with this being said there are use cases in our household when we don’t need all our WiFi AP’s running.

If we are sleeping we don’t need WiFi out in to our front yard and if we are out and the house is fully armed we only need WiFi at the front of our house for re-entry

Calculating Cost
With this being said what does it cost to power an AP? Is it worth the hassle to fiddle with something that works? Our AP’s are PoE based and run at 48v DC and use approx 1AMP. To convert this to watts you can use amps multipled by volts
1 amp * 48v = 48w
So assuming power draw is 48w and power costs 30c a killowat hour
0.048 * 0.30 = $ per hour * 24 * 365 = $126.14

It costs approx $125 to run a single access point for a year, so our annual power cost for WiFi is $375. It is worth it

The Solution
The Homevision Pro (PLC) and Inner Range Integriti (Alarm System) talk to each other. When the alarm changes state the PLC knows.
So with the ability to read data off the serial stream coming from the Inner Range Integriti we can take action and turn off our AP’s based on alarm system status.

Without delving to much in to the rules and operation of our house I derived a simple script that would manipulate the state of the switch ports to which the AP’s are plugged in to. They get disconnected when not needed and reconnected to the network when need, all of which is based on the alarm status.

The code snippet below relies on the following technologies and assumptions
– Cisco IOS operating system with Telnet enabled
– VBScript compiler
– Not a switch stack

The idea is portable and could be modified to suit any technology platform


'---------------- DO NOT EDIT BELOW THIS LINE ------
' **************************************************
' * Author - Shane Baldacchino *
' * Version - 1.0 *
' * Email - shane@baldacchino.net *
' * File Name - CiscoSwitchPorts.vbs *
' * Script Language - Microsoft VB Script *
' * Creation Date - Tuesday 23rd, December 2014 *
' * Modified Date - Tuesday 23rd, December 2014 *
' **************************************************
'On Error Resume Next

'---------------- EDIT BELOW THIS LINE -------------
'Versions
ScriptVersion = 1.0
'Cisco Switch IP
Cisco_Switch_IP = "xxx.xxx.xxx.xxx'
'admin password
admin_password = "xxxxxxxx"
'en password
en_password = "xxxxxxxxx"
'---------------- DO NOT EDIT BELOW THIS LINE --------

Set args = WScript.Arguments
'Shutdown(0) or NoDown(1).

set oShell = CreateObject("WScript.Shell")
oShell.run"cmd.exe"
WScript.Sleep 500
oShell.SendKeys"telnet " & Cisco_Switch_IP
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys & admin_password
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"en"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys & en_password
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"config t"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"int fa0/" & args(1)
oShell.SendKeys("{Enter}")
wscript.Sleep 1500
Select Case args(0)
Case 0
oShell.SendKeys"shutdown"
Case 1
oShell.SendKeys"no shutdown"
End Select
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500

'Code to log to database
'------Removed for blog ---------

Wscript.echo Now & "| Script Processing Complete"
Wscript.echo Now & "| Script Terminating"
Wscript.quit

Executing The Script
The script above has two arguments
– argument 0 = 0/1 [0 being power state off, 1 being power state on]
– argument 1 = int [switch interface port]

A video of the script in action can be found here

Summing It Up
The script above is generic means to manipulate the switch ports and how you link things together is up to you. Without divulging how our house operates this script is called by the PLC when alarm system state changes either to to turn off and on AP’s.

Based on a weeks usage (logged to a database) our 3 AP’s have gone from 24 hours usage each day to approximately 14 hours usage and apart from being awesome to watch it saves a few dollars

48watts * 0.30 kilowat hour cost * 10 hours avg use * 365days * 3AP's = $157.68

In our case $157 dollars per year of electricity use. Minor but it all adds up and why power something when you don’t need it? Plus from a security perspective you are reducing your surface attack area when AP’s are powered off.

Shane Baldacchino

Leave a Comment