This is a Python script for displaying two sets of temperature and humidity data on a 2.7" PaPiRus e-link display that's attached to a Raspberry Pi. It reads the temperature/humidity data from two MQTT topics, and a third topic is used to determine whether the display should be on at all. The latter part is designed for use with my esp32-sensor-reader-mqtt repository with an attached VL53L1X distance sensor to trigger the display to turn on and off when movement is detected.
- Follow the instructions in PiSupply's PaPiRus repository to install the required build and Python libraries and to build, install, and configure the driver.
⚠️ If you're running the "Lite" version of Debian on your Raspberry Pi, you'll need to additionally runsudo apt-get install raspberrypi-kernel-headers libraspberrypi-dev
or you'll receive abcm_host.h: No such file or directory
error when trying to build the PaPiRus driver.
- Run
sudo apt-get install python3-asyncio-mqtt
to install the Python MQTT library.
Create a file at the root level of the repository called config.json
with the following contents:
{
"broker": "<MQTT_BROKER_ADDRESS>",
"upper_location_topic": "<MQTT_TOPIC_FOR_UPPER_TEMPERATURE_DATA>",
"lower_location_topic": "<MQTT_TOPIC_FOR_LOWER_TEMPERATURE_DATA>",
"display_control_topic": "<MQTT_TOPIC_FOR_TRIGGERING_DISPLAY_UPDATES>"
}
The upper_location_topic
and lower_location_topic
messages should contain a payload that looks like this:
{
"temperature": <NUMBER>,
"humidity": <NUMBER>
}
The display_control_topic
payload looks like this:
{
"triggered": <BOOLEAN>
}
If triggered
is set to true
, the display will update once every minute with the latest data for the two location topics. If triggered
is set to false
, the display will be cleared and no updates will occur until it receives a new "triggered": true
payload.
The font Pixellium used in this project is licensed as Creative Commons (by-nd) Attribution No Derivatives.