Educational example of pure Python props using pygame.
An educational example which makes a LED blinking and making a sound.
This props uses Pygame and extends ThreadingProp (so it uses multi-threading).
See INSTALLATION.md and as a good habit is the PyProps folder is /home/pi/Room/Props/PyProps
If you don't install the whole PyProps library, you will have to fulfill the PygameBlinkProp requirements:
PyProps/core/ThreadingProp.pyPyProps/core/PropApp.pyPyProps/core/MqttApp.pyPyProps/core/PropData.pyPyProps/core/Singleton.py
And you will have to install following Python packages:
$ pip3 install paho-mqtt
$ pip3 install PyYAMLStart main.py script in /home/pi/Room/Props/PyProps/PygameProp/PygameBlinkProp:
pi@raspberrypi:~ $ python3 ~/Room/Props/PyProps/PygameProp/PygameBlinkProp/main.py -s 192.168.1.42 -d
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Config: {'host': '192.168.1.42'}
/home/pi/Room/Props/PyProps/PygameProp/PygameBlinkProp/BlinkApp.py:27: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(GPIO_BLINKING_LED, GPIO.OUT, initial=GPIO.LOW)
INFO - New boolean Publishable 'led' (1/0) with initial=0
INFO - New boolean Publishable 'blinking' (yes/no) with initial=0
INFO - Program connected to MQTT server
INFO - Program sending message 'CONNECTED' (mid=1) on Room/My room/Props/Raspberry PygameBlink/outbox
INFO - Program subscribing to topic (mid=2) : Room/My room/Props/Raspberry PygameBlink/inbox
INFO - Program sending message 'DATA led=0 blinking=no' (mid=3) on Room/My room/Props/Raspberry PygameBlink/outbox
DEBUG - MQTT message is published : mid=1 userdata={'host': '192.168.1.42', 'port': 1883}
INFO - Message published (mid=1)
DEBUG - MQTT message is published : mid=3 userdata={'host': '192.168.1.42', 'port': 1883}
INFO - Message published (mid=3)
DEBUG - MQTT topic is subscribed : mid=2 granted_qos=(0,)
INFO - Program susbcribed to topic (mid=2) with QoS (0,)The command to relaunch the prop is :
$ ps aux | grep python | grep -v "grep python" | grep PygameBlinkProp/main.py | awk '{print $2}' | xargs kill -9 && screen -d -m python3 /home/pi/Room/Props/PyProps/PygameProp/PygameBlinkProp/main.py -s %BROKER%Pygame Blink Prop as a prop for xcape.io Room
To use PygameBlinkProp as a prop for xcape.io Room software, here are props commands and messages as well as a suggested control panel.
blink:0: deactivate blinkingblink:1: activate blinkingsound:0: mute blinking soundsound:1: unmute blinking sound
Add and configure Raspberry PygameBlink connected props.
Faure Systems (Apr 10th, 2020)


