# Easiest flow for button held dim

**URL:** <https://community.homey.app/t/easiest-flow-for-button-held-dim/10727>\
**Category:** Questions & Help\
**Created:** [March 17, 2019, 7:33pm UTC](https://community.homey.app/t/easiest-flow-for-button-held-dim/10727 "2019-03-17T19:33:05Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Matthieu\_Oostveen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/matthieu_oostveen/32/8304_2.png) [@Matthieu\_Oostveen](https://community.homey.app/u/Matthieu_Oostveen)\
**Post date:** [April 18, 2019, 10:03am UTC](https://community.homey.app/t/easiest-flow-for-button-held-dim/10727/9 "2019-04-18T10:03:23Z")

</div>

I have actually been working on this for a bit of late, so maybe what I have done can be of use for you.

I am using a Xiaomi button that has the long-press function and an IKEA Tradfri bulb, I am also using the transitions app that @viix suggested.

On long-press, I check what the DimUP boolean is saying (true = dim UP), if it is true I start a transition from the current dimlevel of the bulb to 1 in 5 seconds with 0.5s steps. If it is false, I go to 0.  
At the same time I tell the bulb to start dimming to 100% (or 0%) in 5 seconds as well.

 ![10](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/4/4565e03a8873d0c537636f11da719b01f577ec9b.jpeg)

This only dims to full or off, so to stop the dimming something needs to happen when the button is released. Which is my next flow; I stop the transition and toggle the up/down so next time I dim the other way. (Forget the paper trail card, I need to tak ethat out still)

 ![40](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/f/f575d373e3c87d60a815e3416f0199b6a1147208.jpeg)

Now for the actual setting of the final dim-level, I created a third flow that takes the value that is in the transition and set it as the dim-level, only this time I dim to that immediately;

 ![59](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/1/1870ab6e8ffef1c2d665d80c386cd5b99d04765d.png)

Initially, I had another flow to change the dim-level immediately every time the transition value changed but that meant that the dimming level would “jump” to the next value which I didn’t like; this way it is a lot smoother and there is only a small “jump” when you release the button.

Hope that helps,  
Matthieu

---

_[View the full topic](https://community.homey.app/t/easiest-flow-for-button-held-dim/10727)._
