Misunderstanding SubFlow input

I have these nodes:
Schermafbeelding 2023-10-24 om 07.54.57

[{"id":"88dec55dd6167201","type":"subflow","name":"Variable sec + stop","info":"","category":"","in":[{"x":60,"y":80,"wires":[{"id":"8ffd63902428e96b"},{"id":"a9385094a68c6646"}]}],"out":[],"env":[{"name":"payload","type":"str","value":"{{msg.payload}}","ui":{"label":{"en-US":"payload"}}},{"name":"delay","type":"num","value":"{{msg.delay}}","ui":{"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#F3B567","icon":"node-red-contrib-bigtimer/timer.png","status":{"x":640,"y":140,"wires":[{"id":"75ec09693e67a8a4","port":1}]}},{"id":"75163226fcb9816d","type":"change","z":"88dec55dd6167201","name":"STOP timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":40,"wires":[["9074262e20b8c7c5"]]},{"id":"75ec09693e67a8a4","type":"api-current-state","z":"88dec55dd6167201","name":"is {{payload.data.entity_id}} ON?","server":"6182da52.101a64","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"{{payload.data.entity_id}}","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"delay","propertyType":"msg","value":"{{msg.payload.delay}}","valueType":"num"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":430,"y":80,"wires":[["75163226fcb9816d","1c48bd3d99da4462","569a287552cd34fa"],["9074262e20b8c7c5","569a287552cd34fa"]]},{"id":"52d6c3811384e498","type":"api-call-service","z":"88dec55dd6167201","name":"{{payload}} UIT","server":"6182da52.101a64","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["{{payload}}"],"data":"{ \"transition\": 0.5 }","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":140,"wires":[[]]},{"id":"9074262e20b8c7c5","type":"delay","z":"88dec55dd6167201","name":"","pauseType":"delayv","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":860,"y":140,"wires":[["52d6c3811384e498"]]},{"id":"1c48bd3d99da4462","type":"debug","z":"88dec55dd6167201","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":550,"y":220,"wires":[]},{"id":"8ffd63902428e96b","type":"debug","z":"88dec55dd6167201","name":"Input","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":230,"y":160,"wires":[]},{"id":"569a287552cd34fa","type":"debug","z":"88dec55dd6167201","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.delay","targetType":"msg","statusVal":"payload","statusType":"auto","x":570,"y":260,"wires":[]},{"id":"a9385094a68c6646","type":"delay","z":"88dec55dd6167201","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":210,"y":80,"wires":[["75ec09693e67a8a4"]]},{"id":"ddfb8721cf8396bb","type":"switch","z":"88dec55dd6167201","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":290,"y":360,"wires":[[]]},{"id":"0c62e4efefcd325c","type":"api-call-service","z":"474824f0fc939212","g":"5a1b12290db32fe9","name":"Zolder Lamp 20% ON","server":"6182da52.101a64","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.zolder_lamp"],"data":"{\t   \"brightness_pct\": 40,\t   \"color_temp\": 454}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"},{"property":"payload.delay","propertyType":"msg","value":"10","valueType":"num"}],"queue":"all","x":780,"y":1340,"wires":[["3b8a482ce4b1d3d6","3729145209ede9a7"]]},{"id":"3b8a482ce4b1d3d6","type":"subflow:88dec55dd6167201","z":"474824f0fc939212","g":"5a1b12290db32fe9","name":"","x":1110,"y":1340,"wires":[]},{"id":"6182da52.101a64","type":"server","name":"Wolk 9 Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"10","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

and the subflow:

[{"id":"75163226fcb9816d","type":"change","z":"88dec55dd6167201","name":"STOP timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":40,"wires":[["9074262e20b8c7c5"]]},{"id":"75ec09693e67a8a4","type":"api-current-state","z":"88dec55dd6167201","name":"is {{payload.data.entity_id}} ON?","server":"6182da52.101a64","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"{{payload.data.entity_id}}","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"delay","propertyType":"msg","value":"{{msg.payload.delay}}","valueType":"num"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":430,"y":80,"wires":[["75163226fcb9816d","1c48bd3d99da4462","569a287552cd34fa"],["9074262e20b8c7c5","569a287552cd34fa"]]},{"id":"52d6c3811384e498","type":"api-call-service","z":"88dec55dd6167201","name":"{{payload}} UIT","server":"6182da52.101a64","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["{{payload}}"],"data":"{ \"transition\": 0.5 }","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":140,"wires":[[]]},{"id":"9074262e20b8c7c5","type":"delay","z":"88dec55dd6167201","name":"","pauseType":"delayv","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":860,"y":140,"wires":[["52d6c3811384e498"]]},{"id":"1c48bd3d99da4462","type":"debug","z":"88dec55dd6167201","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":550,"y":220,"wires":[]},{"id":"8ffd63902428e96b","type":"debug","z":"88dec55dd6167201","name":"Input","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":230,"y":160,"wires":[]},{"id":"569a287552cd34fa","type":"debug","z":"88dec55dd6167201","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.delay","targetType":"msg","statusVal":"payload","statusType":"auto","x":570,"y":260,"wires":[]},{"id":"a9385094a68c6646","type":"delay","z":"88dec55dd6167201","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":210,"y":80,"wires":[["75ec09693e67a8a4"]]},{"id":"6182da52.101a64","type":"server","name":"Wolk 9 Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"10","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

The subflow above is fed by my call-service node with a msg.payload where the entity_id is derivated from and a msg.delay where I define the wait time in seconds (as a number) to turn the light off. However, my subflow says that the input of msg.delay ‘is not a number’. I’ve tried many things but I can’t get it working.

Can anyone help me out, and -just as important- explain me what is going wrong where?

Thanks a million in advance.