A connected props to echo messages to its sender.
Discontinued, prefer PyBlinkEcho in PyProps library
PyEcho props is pure python application to build a Raspberry connected props for Escape Room. It can be used as a base example to hack for creating your own props. It is used in the Room plugin tutorial.
This props listen to MQTT messages received in its inbox and replies the message to its sender.
The props is intended to be controlled from xcape.io Room software, see Add a Raspberry props in the Room manual.
Download PyEchoProps-master.zip
from this GitHub repository and unflate it on your Raspberry Pi.
Install dependencies
pip3 install -r requirements.txt
Edit definitions.ini
to set MQTT topics for your Escape Room:
[mqtt]
; mqtt-sub-* and app-inbox topics are subscribed by MqttApp
app-inbox = Room/My room/Props/Raspberry Echo/inbox
app-outbox = Room/My room/Props/Raspberry Echo/outbox
mqtt-sub-room-scenario = Room/My room/Control/game:scenario
;mqtt-sub-control-scenario = Room/My room/Control/game:scenario
;mqtt-sub-control-clock-minutes=Room/My room/Control/game:clock:minutes
;mqtt-sub-control-countdown-minutes=Room/My room/Control/game:countdown:minutes
;mqtt-sub-control-players=Room/My room/Control/game:players
Start main.py
script:
usage: python3 main.py [-h] [-s SERVER] [-p PORT] [-d] [-l LOGGER]
optional arguments:
-h, --help show this help message and exit
-s SERVER, --server SERVER
change MQTT server host
-p PORT, --port PORT change MQTT server port
-d, --debug set DEBUG log level
-l LOGGER, --logger LOGGER
use logging config file
To switch MQTT broker, kill the program and start again with new arguments.
The command to relaunch the props from xcape.io Room software is :
$ ps aux | grep python | grep -v "grep python" | grep PyEchoProps/main.py | awk '{print $2}' | xargs kill -9 && screen -d -m python3 /home/pi/Room/Props/PyEchoProps/main.py -s %BROKER%
Echo props is built with the following files:
main.py
main script to start the propsconstants.py
definitions.ini
logging.ini
PropsApp.py
props related code
It depends on:
MqttApp.py
base class to publish/subscribe MQTT messagesMqttVar.ini
base class to optimize network communicationsSingleton.ini
to ensure one instance of application is running
You can use PropsApp.py
as a template to create your own connected props, you will also add GPIO elements.
About create-props-tgz.bat
:
- install 7-Zip on your Windows desktop
- run
create-props-tgz.bat
to archive versions of your work
This props has been created to be controlled with Room software so MQTT messages published in the props outbox implement the Room Outbox protocol.
You can open a PyCharm Professional project to hack the code remotely, thanks to
.idea
folder. Or if you prefer to the code hack directly on the Raspberry, we suggest Eric6 IDE.
PropsApp extends MqttApp, the python base app for Raspberry connected props.
MQTT topics are defined in definitions.ini.
PubSub variables extend MqttVar, it is an helper to track value changes and to optimize publishing values in MQTT topic outbox.
You might not modify MqttApp.py
an MqttVar.py
files.
Python script hangs have been reported when
paho-mqtt
is running asynchronously with QoS 2 on a network with significant packet loss (particularly Wifi networks).
We have choosen MQTT QoS 1 as default (see constants.py).
At Faure Systems we engineered connected props with several frameworks for many different needs:
- Asyncio props
- game automation
- relay box control (room electricity and doors)
- GPIO only automation
- PyGame props
- Tetris hacked
- mechanic Piano sound player
- hacker intrusion puzzle
- PyQt5 props
- fortune telling table (alphanum LED switching)
- electric jack cylinder control
- Guizero props
- teletext
- Kivy props
- teletext with visual effects
You may follow on our GitHub repositories, props source code is planned to be published in year 2020.
Faure Systems (Oct 9th, 2019)
- company: FAURE SYSTEMS SAS
- mail: dev at faure dot systems
- github: fauresystems
- web: Faure Systems