[{"id":"98c6d742.6646b8","type":"api-call-service","z":"fac037bf.a42d78","name":"Night Light","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.night_light\",\"brightness\":\"{{brightness}}\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":790,"y":1456,"wires":[[]]},{"id":"84b16be7.511d68","type":"function","z":"fac037bf.a42d78","name":"Increment","func":"const step = 45;\nconst brightness = msg.payload === \"off\" ? 5 : Math.min(parseInt(msg.data.attributes.brightness) + step, 255);\n\nmsg.payload = {\n data: {\n brightness: brightness\n }\n};\n\nreturn [msg, brightness === 255 ? null : 0];","outputs":2,"noerr":0,"x":604,"y":1456,"wires":[["98c6d742.6646b8"],["36420a4b.f3b0d6"]]},{"id":"97679116.88dfc","type":"api-current-state","z":"fac037bf.a42d78","name":"Night Light","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.night_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":454,"y":1456,"wires":[["84b16be7.511d68"]]},{"id":"36420a4b.f3b0d6","type":"delay","z":"fac037bf.a42d78","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":796,"y":1504,"wires":[["97679116.88dfc"]]},{"id":"c47220ca.eb63f","type":"inject","z":"fac037bf.a42d78","name":"Pushed","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":274,"y":1456,"wires":[["97679116.88dfc"]]},{"id":"27bafe1.957ce02","type":"inject","z":"fac037bf.a42d78","name":"Released","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":284,"y":1504,"wires":[["45494507.3c090c"]]},{"id":"45494507.3c090c","type":"change","z":"fac037bf.a42d78","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":464,"y":1504,"wires":[["36420a4b.f3b0d6"]]}]
edit: the code is actually increasing the brightness but should be easy enough to swap around.