Create an action depending on the amount of time a device was off

Hi. I am trying to create a flow that has two devices, A and B.

I want device B to turn on when device A is manually turned on, but only if device B was off for at least 15 minutes.

Any help would be appreciated!
Thanks,
Rodrigo

EDIT: I was able to achieve it by creating a sequence with event state node for device B that affects a boolean variable when this device was off for 15 minutes, and then a the main sequence has a switch node that reacts depending on this variable. But I am still interested of finding a way to do all this in less nodes and without creating a variable.

[{"id":"e431aeb646c00395","type":"server-state-changed","z":"878e74c2.7f39c8","name":"A manually on?","server":"9405c3fe.d0a6c","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"A","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":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[],"x":320,"y":240,"wires":[["ad24991262df2797"],[]]},{"id":"ad24991262df2797","type":"api-current-state","z":"878e74c2.7f39c8","name":"B off for 15'?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"B","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"15","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":490,"y":240,"wires":[["ead781572e472875"],[]]},{"id":"ead781572e472875","type":"api-call-service","z":"878e74c2.7f39c8","name":" B on","server":"9405c3fe.d0a6c","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":240,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

Hi @obaldius, thanks for your reply. I tried this before and somehow it didn’t work (clearly I did something wrong at the first try). Now it worked OK, thanks again.

R.