OctoPrint plugin to add LYWSD03MMC temperature and humidity sensor data to PlotlyTempGraph.
This plugin integrates Xiaomi Mijia LYWSD03MMC Bluetooth temperature and humidity sensors with OctoPrint's PlotlyTempGraph plugin. It allows you to monitor environmental conditions around your 3D printer by displaying sensor data directly in the temperature graph.
- Read temperature and humidity from LYWSD03MMC Bluetooth sensors
- Display sensor data in OctoPrint's temperature graph (requires PlotlyTempGraph plugin)
- Configurable update interval
- Optional display of humidity and battery level
- Customizable graph labels
- OctoPrint
- PlotlyTempGraph plugin
- LYWSD03MMC Bluetooth temperature and humidity sensor
- Bluetooth support on your OctoPrint host (e.g., Raspberry Pi with built-in Bluetooth)
- Python 3.x
This plugin requires the PlotlyTempGraph plugin to display sensor data in the temperature graph.
Install PlotlyTempGraph via the Plugin Manager or using this URL:
https://github.com/jneilliii/OctoPrint-PlotlyTempGraph/archive/master.zip
Install via the bundled Plugin Manager or manually using this URL:
https://github.com/yutaka551/lywsd03mmc-plugin-for-plotly-temp-graph/archive/master.zip
After installation, you may need to install system dependencies:
sudo apt-get install python3-pip libglib2.0-devYou can find your sensor's MAC address using one of these methods:
Method 1: Using Xiaomi Home App
- Open the Xiaomi Home app
- Go to your sensor's settings
- Look for the MAC address in the "About" section
Method 2: Using hcitool on Linux
sudo hcitool lescanLook for devices named "LYWSD03MMC" and note the MAC address (e.g., A4:C1:38:12:34:56).
- Open OctoPrint settings
- Navigate to the "LYWSD03MMC Plugin for PlotlyTempGraph" section
- Enter your sensor's MAC address
- Configure the update interval (default: 60 seconds)
- Choose which data to display:
- Temperature (always displayed)
- Humidity (optional)
- Battery level (optional)
- Customize graph labels if desired
- Save settings
After configuration, restart OctoPrint. Check the logs (Settings → Logging) for messages like:
LYWSD03MMC Plugin for PlotlyTempGraph started
Starting sensor monitoring for MAC: A4:C1:38:12:34:56
The sensor data should appear in your temperature graph within the configured update interval.
| Setting | Description | Default |
|---|---|---|
| MAC Address | Bluetooth MAC address of your LYWSD03MMC sensor | (empty) |
| Update Interval | How often to poll the sensor (in seconds) | 60 |
| Display Humidity | Show humidity readings in the graph | Yes |
| Display Battery | Show battery level in the graph | No |
| Temperature Label | Label for temperature in the graph | LYWSD03MMC Temp |
| Humidity Label | Label for humidity in the graph | LYWSD03MMC Humidity |
| Battery Label | Label for battery level in the graph | LYWSD03MMC Battery |
If the plugin cannot connect to your sensor:
- Check MAC address: Ensure the MAC address is entered correctly
- Check Bluetooth range: Make sure the sensor is within range of your OctoPrint host
- Check permissions: The OctoPrint user may need Bluetooth permissions
- Check for other connections: The sensor can only maintain one BLE connection at a time
If you see permission errors in the logs, you may need to grant Bluetooth capabilities:
sudo setcap 'cap_net_raw,cap_net_admin+eip' $(readlink -f $(which python3))Or run OctoPrint with appropriate permissions (not recommended for production).
- Check OctoPrint logs for error messages
- Verify PlotlyTempGraph plugin is installed and active
- Ensure update interval has elapsed since plugin start
- Try manually testing the sensor connection:
pip install lywsd03mmc lywsd03mmc A4:C1:38:12:34:56
This plugin uses the lywsd03mmc Python library to communicate with the sensor via Bluetooth Low Energy (BLE). It runs a background thread that periodically polls the sensor and injects the data into OctoPrint's temperature reporting system using the octoprint.comm.protocol.temperatures.received hook, making it compatible with PlotlyTempGraph and other temperature-aware plugins.
Licensed under the MIT License. See the LICENSE file for details.
For issues, feature requests, or questions, please use the GitHub issue tracker.