Need help with simple Node Red flow

I’m working on a simple flow for lighting. I need it to check the current lamp brightness, and if it is less than the input number (AM brightness), set the light brightness to the input number value. Right now it sets the light based on the input number value, but I can’t figure out how to make it check the current brightness first. How can I integrate this into my flow?

[{"id":"47f4fe7a6aed75b7","type":"inject","z":"22602e37d8509ead","name":"Test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1920,"wires":[["571753b4b7eee848"]]},{"id":"571753b4b7eee848","type":"api-current-state","z":"22602e37d8509ead","name":"AM Brightness Slider","server":"9e975189.a3282","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.family_room_lighting_morning_brightness","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":300,"y":1920,"wires":[["d731ca1b2a489c17"]]},{"id":"9bd18070e3b5b40a","type":"api-call-service","z":"22602e37d8509ead","name":"North & South Lamp","server":"9e975189.a3282","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.north_family_room_lamp","light.south_family_room_lamp"],"data":"{ \"brightness_pct\": \"{{ payload }}\" }","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":1920,"wires":[[]]},{"id":"d731ca1b2a489c17","type":"function","z":"22602e37d8509ead","name":"Set Morning Brightness","func":"// Get the morning brightness value from the input_number node\nconst morningBrightness = flow.get(\"input_number.family_room_lighting_morning_brightness\");\n\n// Convert the percentage to the range expected by Hue lights (0 to 254)\nconst hueBrightness = Math.round((morningBrightness * 254) / 100);\n\n// Set the brightness value to be sent to the lights\nmsg.data = {\n brightness_pct: hueBrightness\n};\n\n// Return the modified msg object\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":1920,"wires":[["9bd18070e3b5b40a"]]},{"id":"9e975189.a3282","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}]

Add a second Current State node in-line, set one of it’s output properties (i.e: msg.current_brightness) to a JSONata string to grab the current brightness value:

$entities("light.north_family_room_lamp").attributes.brightness