Skip to content

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.

License

Notifications You must be signed in to change notification settings

VirtualWolf/papirus-temperature-displayer-mqtt

Repository files navigation

papirus-temperature-displayer-mqtt

Overview

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.

Prerequisites

  • 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 run sudo apt-get install raspberrypi-kernel-headers libraspberrypi-dev or you'll receive a bcm_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.

Configuration

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.

Credits

The font Pixellium used in this project is licensed as Creative Commons (by-nd) Attribution No Derivatives.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Languages