Twitchmas Tree is an interactive Christmas tree, streamed on Twitch during the holidays.
Chat is able to change the colors & animations of the lights, and send messages to be shown on the LCD display in the tree.
At the heart of it all is a Raspberry Pi 4 single board computer, which streams the camera image with overlay and music.
A Python-based bot listens to the Twitch chat, and changes the lights and LCD connected to its GPIO ports.
Although a Pi 4 is not ideal for streaming (most streamers use GPU encoding for their Twitch stream to provide a smooth experience), it does seem to manage the task reasonably well.
Some buffering may occur, as CPU/GPU usage typically hovers around 70 to 80%, with occasional spikes to full load.
This isn't intended as a professional or high-end stream by any means, so I'm comfortable with this compromise.
Well, why not? This was a fun opportunity to spread some holiday cheer, and gave me a good excuse to try to write a Twitch bot :)
There are a few commands you can try.
!color {color} - Sets the lights to a certain color (e.g. "red" or "green")
!gradient {color1} {color2} - Creates a gradient using color1 and color2
!gradient {preset} - Sets a gradient using a preset
!rainbow {speed} - Rainbow. Speed (optional) sets the speed at which the rainbow moves
!pulse {color} {speed} - Pulses the lights in a certain color at a certain speed
!message {effect} {line1|line2|line3} - Effect (any of the above) is optional. Sets a message on each line of the display
!presets - Shows all presets in chat for the gradient effect
!help or !commands - Shows a list of commands in chat