How can I dim light to a min number amount

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

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:

[{"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":[[]]}]

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:

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