I’ve been working on enhancing my office lighting setup using Node-RED, and I thought I’d share my journey and findings with the community. The goal was to create a seamless automation system that adjusts the lights based on occupancy, luminance, and user input, all while ensuring smooth transitions and minimal interference.The office is equipped with three Hue lights, a Hue remote, and a Hue sensor (for occupancy and luminance detection), all integrated via ZHA. Initially, I set up scenes for different lighting needs: ‘Office On’ for general lighting, ‘Workbench’ for task lighting, and ‘Walk-In’ for when I enter the room. The system was designed to record the last scene set and revert to it if the occupancy sensor was triggered while the lights were already on.However, I encountered an issue when using the Dim Up/Down buttons on the Hue remote. The system would inadvertently turn on the workbench light while adjusting the brightness of the other two lights. This was unintended and a bit frustrating. After some debugging, I realized the problem stemmed from how the service call was structured—it wasn’t filtering out the lights that were already off.To resolve this, I utilized the ha-get-entities service within Node-RED to fetch the current state of the light group. This allowed me to identify which lights were on and adjust only those. By incorporating this step, I ensured that the Dim Up/Down commands only affected the lights that were actively on, preventing the unexpected activation of the workbench light.This experience taught me the importance of filtering and state checking in automation workflows, especially when dealing with multiple devices. It also highlighted the versatility of Node-RED in handling such scenarios with a bit of customization.I’m now enjoying a much smoother lighting experience in my office, and I hope sharing this tweak can help others refine their own setups. If anyone has similar challenges or tips, I’d love to hear about them!