The standard nodes can help here, and in this case you can use the trigger node that can "hold" the message for x time. Send a msg.reset to it if value != On or 1.
Example flow:
[
{
"id": "d00ea6ff78d085b2",
"type": "inject",
"z": "7b1ac6193bf71367",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "On",
"payloadType": "str",
"x": 270,
"y": 300,
"wires": [
[
"f809eb7bf9e8592a"
]
]
},
{
"id": "0f07c030672ecbae",
"type": "inject",
"z": "7b1ac6193bf71367",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "str",
"x": 270,
"y": 340,
"wires": [
[
"f809eb7bf9e8592a"
]
]
},
{
"id": "39e37785a2957881",
"type": "inject",
"z": "7b1ac6193bf71367",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "something else",
"payloadType": "str",
"x": 300,
"y": 380,
"wires": [
[
"f809eb7bf9e8592a"
]
]
},
{
"id": "f809eb7bf9e8592a",
"type": "switch",
"z": "7b1ac6193bf71367",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "On",
"vt": "str"
},
{
"t": "eq",
"v": "1",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 450,
"y": 340,
"wires": [
[
"0e73367409c5a5bd"
],
[
"0e73367409c5a5bd"
],
[
"994ffeec449c157b"
]
]
},
{
"id": "994ffeec449c157b",
"type": "change",
"z": "7b1ac6193bf71367",
"name": "",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 380,
"wires": [
[
"0e73367409c5a5bd"
]
]
},
{
"id": "0e73367409c5a5bd",
"type": "trigger",
"z": "7b1ac6193bf71367",
"name": "",
"op1": "",
"op2": "1",
"op1type": "nul",
"op2type": "num",
"duration": "5",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 780,
"y": 320,
"wires": [
[
"f0fbaf6071ee18ad"
]
]
},
{
"id": "f0fbaf6071ee18ad",
"type": "debug",
"z": "7b1ac6193bf71367",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "\"timer passed!\"",
"statusType": "jsonata",
"x": 930,
"y": 320,
"wires": []
}
]