I’ve been on a journey to optimize my smart lighting setup, and I wanted to share some of the challenges and successes I’ve encountered. One of my goals was to integrate a custom-built MQTT switch with my existing smart bulbs, allowing for more granular control over lighting scenes. Here’s how I approached it:
The Challenge: I wanted to use a NodeMCU ESP8266 module to create a custom switch that could trigger specific lighting scenes via MQTT. The idea was to have four separate GPIO inputs act as individual switches, each sending a unique MQTT message to Home Assistant. However, I faced an issue where all switches were sending the same message, making it impossible to distinguish between them.
The Solution: After some research and trial and error, I realized that the default configuration wasn’t allowing for unique identifiers. I decided to modify the Tasmota firmware to assign different topics to each switch. By configuring each GPIO input with a unique topic (e.g., stat/NMCU001/POWER1, stat/NMCU001/POWER2), I was able to send distinct messages for each switch. This involved editing the Tasmota configuration to map each GPIO to a specific MQTT topic.
The Outcome: The setup now works seamlessly! Each switch triggers a unique scene in Home Assistant, allowing for a more dynamic and personalized lighting experience. For example, grounding Switch1 triggers a warm evening ambiance, while Switch3 activates a vibrant party mode. This project not only enhanced my home automation setup but also deepened my understanding of MQTT and custom firmware configurations.
I’d love to hear if anyone else has tackled similar projects or has tips for optimizing MQTT-based automation. Let’s continue to innovate and share our experiences to make our smart homes even smarter!