Note
This project has been replaced by a native macOS app MQTTMenuBar ↗
For the best experience on macOS, use the new version.
A lightweight macOS status bar Python script that displays status from MQTT messages — either as colored indicator dots or dynamic text. Perfect for home automation systems, IoT monitoring, or any MQTT-based status indication needs.
- Color-coded indicators: Red, Yellow, and Green dots using macOS-native colors
- Dynamic text display: Show short MQTT-published values like
"17°C","ON", or"75%"in the menu bar - MQTT integration: Connects to any MQTT broker with support for authentication
- Runs in background: No Dock icon; menu bar only
- Automatic reconnection: Handles network interruptions
- Threaded MQTT handling: Keeps the UI responsive
- Built for macOS: Uses PyObjC for seamless system integration
Displays a single colored dot in the menu bar based on incoming MQTT messages.
MQTT Commands:
"red"→ shows a red dot"yellow"→ shows a yellow dot"green"→ shows a green dot"off"→ hides the indicator
macOS Color Mappings:
- Red:
NSColor.colorWithRed_green_blue_alpha_(1.0, 0.231, 0.188, 1.0) - Yellow:
NSColor.colorWithRed_green_blue_alpha_(1.0, 0.8, 0.0, 1.0) - Green:
NSColor.colorWithRed_green_blue_alpha_(0.196, 0.843, 0.294, 1.0)
Change the Indicator Symbol:
You can replace the "●" character with any Unicode symbol you prefer:
"◆"for diamonds"▲"for triangles"★"for stars"■"for squares
Displays a short dynamic text string from MQTT messages directly in the menu bar.
Example MQTT Payloads:
"23°C"→ temperature reading"ON"/"OFF"→ binary state"75%"→ battery or humidity level
This variant is ideal for showing real-time sensor values or device states.
- macOS 10.12 or later
- Python 3.6+
pyobjc-framework-Cocoapaho-mqtt
-
Install Dependencies
pip install paho-mqtt pyobjc-framework-Cocoa
-
Clone Repository
git clone git clone https://github.com/saihgupr/MenuBar cd MenuBar -
Configure MQTT Settings
Edit the following variables in the script:
self.mqtt_broker = "192.168.1.199" # Your MQTT broker IP self.mqtt_port = 1883 # MQTT port (default: 1883) self.mqtt_username = "XXX" # MQTT username self.mqtt_password = "XXX" # MQTT password self.mqtt_topic = "menubar/text" # MQTT topic to subscribe to
-
Run the Application
python3 menubar_dots.py
To run the app automatically when you log in:
- Open System Preferences → Users & Groups
- Select your user account
- Click Login Items tab
- Add the Python script or create a wrapper script
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.

