I’ve been diving into the world of home automation lately, and I must say, it’s been an incredible journey!
I started with YAML automations, which worked perfectly for my smart button setup. The button toggles my light on/off with a single press and adjusts between bright and dim settings when already on. It was all running smoothly until I decided to transition to Node-RED for more flexibility and visual flow management.
The on/off functionality made the move seamlessly, but the brightness adjustment was a bit of a puzzle. I use input_number sliders on my admin dashboard to set the dim and bright levels, and the logic seemed straightforward: check the current brightness, compare it to the average of the two slider settings, and switch accordingly. The YAML code was clear, but translating that into Node-RED required some troubleshooting.
After some research and a few trial runs, I figured out that I needed to fetch the slider values dynamically within the Node-RED flow. Using the input_number nodes to get the current slider values and then calculating the average in a function node did the trick! Now, pressing the button not only toggles the light but also adjusts it to the perfect brightness based on my settings. ![]()
This experience taught me the importance of breaking down problems into smaller parts and leveraging the community resources. If you’re looking to switch from YAML to Node-RED or need help with similar automation, feel free to reach out! Let’s continue to explore and innovate together in the world of smart homes! ![]()
![]()