Aruba Employee

How to: ClearPass Exchange with Raspberry Pi 2/3 LED matrix signage display

Based on authentication or event for displaying user or device information with the LED matrix display using Raspberry Pi 2/3
User Experience
2016-10-31 18.30.45.gif
Preparation Steps
1. Wire up the matrix to your Pi and install Install rpi-rgb-led-matrix
Please refer to
2. Install Flask
3. Write up python code
#!/usr/bin/env python
# Display a runtext with double-buffering.
from samplebase import SampleBase
from rgbmatrix import RGBMatrix,graphics
from flask import request,json,Flask
import time

app = Flask(__name__)

@app.route('/messages', methods = ['POST'])
def api_message():

    if request.headers['Content-Type'] == 'application/json':
	myjson = json.loads(json.dumps(request.json)) # Process json request from CPPM
	runText = RunText()
        runText.matrix = RGBMatrix(16, 2, 1) # Setting up for rows/led-chains
        runText.myTextColorRed = myjson["ColorRed"] # Set the Red Colour from json
        runText.myTextColorGreen = myjson["ColorGreen"] # Set the Green Colour from json
        runText.myTextColorBlue = myjson["ColorBlue"] # Set the Blue Colour from json
        runText.myTextSpeed = myjson["speed"] # Set the Text Speed from json
        runText.myText = myjson["message"] # Set the Message from json
            # Start loop
            print("Press CTRL-C to stop sample")
        except KeyboardInterrupt:
            print "Exiting\n"
	return  json.dumps(request.json)
        return "415 Unsupported Media Type ;)"

class RunText(SampleBase):
    myTextColorRed = 255
    myTextColorGreen = 255
    myTextColorBlue = 255
    myText = ""
    myTextSpeed = 0.05

    def __init__(self, *args, **kwargs):
        super(RunText, self).__init__(*args, **kwargs)
    def Run(self):
        offscreenCanvas = self.matrix.CreateFrameCanvas()
        font = graphics.Font()
        textColor = graphics.Color(self.myTextColorRed, self.myTextColorGreen, self.myTextColorBlue)
        pos = offscreenCanvas.width

        while True:
            len = graphics.DrawText(offscreenCanvas, font, pos, 10, textColor, self.myText)

            pos -= 1
            if (pos + len < 0):
                pos = offscreenCanvas.width

            offscreenCanvas = self.matrix.SwapOnVSync(offscreenCanvas)

# Main function
if __name__ == "__main__":'', port=80, debug=True)

Place your code in the path below


pi@raspberrypi:~/rpi-rgb-led-matrix/python/samples $ 

4. Run the code in the background


pi@raspberrypi:~/rpi-rgb-led-matrix/python/samples $ sudo ./ &

5. Configuration on CPPM


Administration -> External Servers -> Enpiont Context Servers

Screen Shot 2016-11-01 at 3.07.04 PM.png

In Server Tab:


Server Name: <Your integration name>

Server Base URL: http://<Raspberry Pi IP address>


Administration -> Dictionaries -> Context Server Actions


In Action tab:


Action Name: <Action Name>

Descritpion: <Description>


URL: /messages


In Header Tab:


Content-type =  application/json


In Content Tab: 


{"message":"User %{HKSE-AD-User} logged in from SSID %{HKSE-SSID} (%{HKSE-AP-Name}), MAC address: %{HKSE-MAC-Address} and Hostname: %{HKSE-Hostname} - (%{HKSE-Category} / %{HKSE-OS-Family} / %{HKSE-Device-Name})", "ColorRed":248, "ColorGreen":152, "ColorBlue":30, "speed":0.05}


In Attributes Tab:



HKSE-AD-User = %{Authorization:01 - HKSE-AD:Name}
HKSE-AP-Name = %{Connection:AP-Name}
HKSE-MAC-Address = %{Connection:Client-Mac-Address-Colon}
HKSE-SSID = %{Connection:SSID}
HKSE-Category = %{Authorization:[Enpoints Repository]:Category}
HKSE-OS-Family = %{Authorization:[Enpoints Repository]:OS Family}
HKSE-Device-Name = %{Authorization:[Enpoints Repository]:Device Name}
HKSE-Hostname = %{Authorization:[Enpoints Repository]:Hostname}

6. Tips and Tricks


You can customize the message display based on the authorization or connection attributes from the authentication request. You can also customize the colour and speed of the message:


"ColorRed":248, "ColorGreen":152, "ColorBlue":30, "speed":0.05

7. Use cases


- Display customized message when VIP guest entering the shop

- Alert NOC staff when non-compliance device connecting to the network




Contributor II

Re: How to: ClearPass Exchange with Raspberry Pi 2/3 LED matrix signage display

Very cool project!  I'm going to give this a shot.


Maybe as an additional feature, some of the bottom unused rows could be treated as bar graphs for showing the number of successful vs failed authentications, or types of devices, or service categorizations, in the last timeframe - say 1 hour. Center x=0 in the middle, and you could extend both directions on a row for two pieces of info.


Since they are RGB LEDs, using different colors would work nice visually for a few bars; it seems you have about 3-4 LED rows untouched at the bottom to capitalize on.

Search Airheads
Showing results for 
Search instead for 
Did you mean: