# How can I dim light to a min number amount

**URL:** <https://discourse.nodered.org/t/how-can-i-dim-light-to-a-min-number-amount/60241>\
**Category:** General\
**Created:** [23 March 2022 13:23 UTC](https://discourse.nodered.org/t/how-can-i-dim-light-to-a-min-number-amount/60241 "2022-03-23T13:23:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DariBer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dariber/32/58854_2.png) [@DariBer](https://discourse.nodered.org/u/DariBer)\
**Post date:** [23 March 2022 13:23 UTC](https://discourse.nodered.org/t/how-can-i-dim-light-to-a-min-number-amount/60241/1 "2022-03-23T13:23:07Z")

</div>

I'm new to Node-RED so please go easy on me here 🙂

I have created a flow when I change a sensor from off to on it will dim down a light bulb I have in Home Assistant.  
Unfortunately when the dim comes to 0 it turnes off the light. so I would like to make the flow only be allow to dim down to 1 instead of 0, is there any way I can do that.

Here's how my flow looks like now:

```auto
[{"id":"8a6866a13c35aaba","type":"tab","label":"Dim Up - NSPanel-01 - Fonsterlampa Sovrum","disabled":false,"info":"","env":[]},{"id":"4a0afd31427a498f","type":"tab","label":"Dim Down - NSPanel-01 - Fonsterlampa Sovrum","disabled":false,"info":"","env":[]},{"id":"e60a45321a91062b","type":"tab","label":"Toggle NSPanel-01 - Fonsterlampa Sovrum","disabled":false,"info":"","env":[]},{"id":"1d707c49.07a204","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30},{"id":"d446351196fc6420","type":"server-state-changed","z":"8a6866a13c35aaba","name":"One Button Dim Up","server":"1d707c49.07a204","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.nspanel_lab01_dim_up_fonsterlampa","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":80,"wires":[["eab7b30f0048983d"],["bf266cedef20a137"]]},{"id":"bf266cedef20a137","type":"change","z":"8a6866a13c35aaba","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":120,"wires":[["eab7b30f0048983d"]]},{"id":"eab7b30f0048983d","type":"looptimer","z":"8a6866a13c35aaba","duration":"0.2","units":"Second","maxloops":"21","maxtimeout":"1","maxtimeoutunits":"Minute","name":"","x":570,"y":80,"wires":[["9c6349ee052a5ab4"],[]]},{"id":"9c6349ee052a5ab4","type":"api-call-service","z":"8a6866a13c35aaba","name":"Dim Up","server":"1d707c49.07a204","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.fonsterlampa_sovrum"],"data":"{\"brightness_step_pct\": 5, \"transition\": 0.1}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":800,"y":80,"wires":[[]]},{"id":"cfb6231edf7038ac","type":"server-state-changed","z":"4a0afd31427a498f","name":"One Button Dim Down","server":"1d707c49.07a204","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.nspanel_lab01_dim_ner_fonsterlampa","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":120,"y":80,"wires":[["edb58223ca9b9c75"],["55485b30543682a1"]]},{"id":"edb58223ca9b9c75","type":"looptimer","z":"4a0afd31427a498f","duration":"0.2","units":"Second","maxloops":"21","maxtimeout":"1","maxtimeoutunits":"Minute","name":"","x":550,"y":80,"wires":[["f42b82c7b5bcffdd"],[]]},{"id":"55485b30543682a1","type":"change","z":"4a0afd31427a498f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":140,"wires":[["edb58223ca9b9c75"]]},{"id":"f42b82c7b5bcffdd","type":"api-call-service","z":"4a0afd31427a498f","name":"Dim Down","server":"1d707c49.07a204","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.fonsterlampa_sovrum"],"data":"{\"brightness_step_pct\": -5, \"transition\": 0.1}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":80,"wires":[[]]},{"id":"b89340254a35906d","type":"server-state-changed","z":"e60a45321a91062b","name":"Button On/Off","server":"1d707c49.07a204","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.nspanel_lab01_on_fonsterlampa","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":90,"y":100,"wires":[["deef726435827881"],[]]},{"id":"deef726435827881","type":"api-call-service","z":"e60a45321a91062b","name":"","server":"1d707c49.07a204","version":5,"debugenabled":false,"domain":"light","service":"toggle","areaId":[],"deviceId":[],"entityId":["light.fonsterlampa_sovrum"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":270,"y":100,"wires":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 March 2022 14:17 UTC](https://discourse.nodered.org/t/how-can-i-dim-light-to-a-min-number-amount/60241/2 "2022-03-23T14:17:30Z")

</div>

Your three flows have 10 nodes of which 8 are Home Assistant specific (I think). Probably you will get more help in the HA forum.

But there is a Range node which might be useful:

 ![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/d/8dd01c7ea4ed4cbf3b149e02e7f3e150bac6c68d.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 May 2022 14:18 UTC](https://discourse.nodered.org/t/how-can-i-dim-light-to-a-min-number-amount/60241/3 "2022-05-22T14:18:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
