Python Automation
Python is excellent here
Python is one of the best fits for Busylight automation because the public Busylight control surface is just local HTTP.
1. Install​
python -m venv .venv
source .venv/bin/activate
pip install requests
2. Minimal helper​
import requests
BASE_URL = "http://localhost:8989"
def light(red=0, green=0, blue=0):
response = requests.get(
BASE_URL,
params={
"action": "light",
"red": red,
"green": green,
"blue": blue,
},
timeout=2,
)
response.raise_for_status()
def off():
response = requests.get(
BASE_URL,
params={"action": "off"},
timeout=2,
)
response.raise_for_status()
if __name__ == "__main__":
light(red=100)
3. Alert and pulse​
def alert(red=100, green=0, blue=0, sound=5, volume=25):
response = requests.get(
BASE_URL,
params={
"action": "alert",
"red": red,
"green": green,
"blue": blue,
"sound": sound,
"volume": volume,
},
timeout=2,
)
response.raise_for_status()
def pulse(red=100, green=0, blue=0):
response = requests.get(
BASE_URL,
params={
"action": "pulse",
"red": red,
"green": green,
"blue": blue,
},
timeout=2,
)
response.raise_for_status()
4. POST helper​
import json
import requests
BASE_URL = "http://localhost:8989"
def post_light(red=0, green=0, blue=0, sender="SDK"):
payload = {
"action": "Light",
"sender": sender,
"eventtype": "Light",
"eventname": "Color",
"parameter": json.dumps({
"RedRgbValue": red,
"GreenRgbValue": green,
"BlueRgbValue": blue,
}),
}
response = requests.post(BASE_URL, json=payload, timeout=2)
response.raise_for_status()
5. Startup registration​
If you want your Python daemon to behave like a named source inside kuandoHUB, send RegisterDataSource once on startup and CreateInitialPriority during setup.
That pattern is useful for:
- monitoring agents,
- service status daemons,
- incident-response automations,
- local webhook listeners,
- support queue indicators.
6. Example architecture​
busylight_agent/
├── busylight.py
├── events.py
├── integrations/
│ ├── grafana.py
│ ├── github.py
│ └── jira.py
└── main.py
Keep the Busylight module small and deterministic. Let integrations translate domain events into green, yellow, red, pulse, or alert.
7. Good Python use cases​
- CI failure lights
- uptime and on-call status
- build-room indicators
- home-office focus lights
- support queue pressure signals
- manufacturing desk or lab notifications
8. Why Python over JavaScript​
Python usually wins when:
- the integration is daemon-like,
- you already use Python in ops or automation,
- you want easy scheduling and scripting,
- the system listens to multiple external services,
- no browser UI is required.