If no one has scored (or between scores) the light can either remain off or static on whatever color it was last. Here is some code that I came up with to have the light flash between two colors for a score by a team:
# Test app for DMX control of lights
import array
import time
from ola.ClientWrapper import ClientWrapper
universe = 1
wrapper = ClientWrapper()
client = wrapper.Client()
# define color constants
orange = array.array('B', [255, 100, 0])
white = array.array('B', [255, 255, 255])
blue = array.array('B', [0, 0, 255])
yellow = array.array('B', [255, 255, 0])
def DmxSent(state):
wrapper.Stop()
def dmx_team_score(color1,color2):
count = 0
while (count < 20):
count = count + 1
client.SendDmx(universe, color1, DmxSent)
wrapper.Run()
time.sleep(1)
client.SendDmx(universe, color2, DmxSent)
wrapper.Run()
time.sleep(1)
# Bengals score
dmx_team_score(orange,white)
# Rams score
dmx_team_score(blue,yellow)
Thoughts welcomed. Now I just need to find a public API to gather scores, implement the necessary logic, and have this run as a service/daemon somehow polling the API every few seconds or so.