# Variable luminance

**URL:** <https://community.homey.app/t/variable-luminance/57203>\
**Category:** Questions & Help\
**Created:** [December 25, 2021, 5:51pm UTC](https://community.homey.app/t/variable-luminance/57203 "2021-12-25T17:51:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [December 25, 2021, 5:51pm UTC](https://community.homey.app/t/variable-luminance/57203/1 "2021-12-25T17:51:17Z")

</div>

Hello,

I read more than one topics but i can’t find the solution… I want to detect the luminance with a motion detector and set a variable to ‘yes’ or ‘no’.  
You can see my little flow below.

 ![lx cuisine](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/1/213a74049060fe54f316fca216cd77884b105c0f.jpeg)

When the the light becomes less than the treshold the variable isn’t updated… What do I wrong???

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [December 25, 2021, 6:20pm UTC](https://community.homey.app/t/variable-luminance/57203/2 "2021-12-25T18:20:35Z")

</div>

When you want to use “ELSE” then you also must fill in a condition in “AND”, in your example , both cards under “THEN” will be started.

[![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/5/558722846c57a8c77a92bf966da3b4ebe150b5d8.jpeg "How to use "or" and "else in a Homey Flow") ](https://www.youtube.com/watch?v=koZh0lddFBg)

---

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [December 26, 2021, 4:35pm UTC](https://community.homey.app/t/variable-luminance/57203/4 "2021-12-26T16:35:11Z")

</div>

Hello, thx for your answer but I don’t understand you. My english is not so well…

---

<div class="post-metadata">

**Author:** ![johan\_bendz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/johan_bendz/32/10344_2.png) [@johan\_bendz](https://community.homey.app/u/johan_bendz)\
**Post date:** [December 26, 2021, 4:49pm UTC](https://community.homey.app/t/variable-luminance/57203/5 "2021-12-26T16:49:23Z")

</div>

The WHEN-card trigger the flow but you need an AND-card that is checked to have THEN and ELSE work as you intend.

I suggest you add this:  
WHEN: Luminance becomes less than 20 lx  
**AND: Luminance is less than 20 lx**  
THEN: Set lx in cuisine to Yes  
ELSE: Set lx in cuisine to No

---

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [December 27, 2021, 3:48pm UTC](https://community.homey.app/t/variable-luminance/57203/6 "2021-12-27T15:48:25Z")

</div>

Hello Johan,

I have only 2 cards available for the sensor when I want to fill in the ‘and’ field… Both are ‘motion’ cards…

 ![1](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/1/f192887a07250a967e8aa170df32356b00e514fa.jpeg)

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [December 27, 2021, 3:55pm UTC](https://community.homey.app/t/variable-luminance/57203/7 "2021-12-27T15:55:31Z")

</div>

I think this would achieve what you want. The last card has `Set lum to yes` but should be no (seems its a bug in the share a flow view).

---

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [December 27, 2021, 5:06pm UTC](https://community.homey.app/t/variable-luminance/57203/8 "2021-12-27T17:06:40Z")

</div>

It’s working!!! Thanks a lot !!!  
I think with this manner of thinking I can solve other small issues…
