Timerswitch ... how to stop/forward other message based on timerswitch?

I thought timwerswitch would simple stop a chain of events depending on time - no such luck.
It's apparently not working this way - the "edit change node" is preparing a msg.payload.alarm
..then the idea is NOT to forward it further to the siren/debug if time is outside the defined range.
What is the proper way to do this?

[
    {
        "id": "d3759ed41626ef03",
        "type": "mqtt in",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "topic": "zigbee2mqtt/Garage-door",
        "qos": "2",
        "datatype": "json",
        "broker": "f1e35a75c0e044b3",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 150,
        "y": 420,
        "wires": [
            [
                "2dfcf4a934bd3411"
            ]
        ]
    },
    {
        "id": "2dfcf4a934bd3411",
        "type": "rbe",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload.contact",
        "topi": "topic",
        "x": 370,
        "y": 420,
        "wires": [
            [
                "a51870e4e4a57988",
                "29c10c7b22b20fee"
            ]
        ]
    },
    {
        "id": "a51870e4e4a57988",
        "type": "debug",
        "z": "f6f2187d.f17ca8",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 940,
        "y": 460,
        "wires": []
    },
    {
        "id": "beb8cc5d23e06a73",
        "type": "timerswitch",
        "z": "f6f2187d.f17ca8",
        "name": "Inhibit day",
        "ontopic": "",
        "offtopic": "",
        "onpayload": "",
        "offpayload": "",
        "disabled": false,
        "schedules": [
            {
                "on_h": "06",
                "on_m": "30",
                "on_s": "00",
                "off_h": "14",
                "off_m": "30",
                "off_s": "00",
                "valid": true
            }
        ],
        "x": 710,
        "y": 540,
        "wires": [
            [
                "a18775ac8b5754c9",
                "bfa846944a6506ec"
            ]
        ]
    },
    {
        "id": "a18775ac8b5754c9",
        "type": "debug",
        "z": "f6f2187d.f17ca8",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 940,
        "y": 540,
        "wires": []
    },
    {
        "id": "bfa846944a6506ec",
        "type": "mqtt out",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "topic": "zigbee2mqtt/Garage-siren/set",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "f1e35a75c0e044b3",
        "x": 1010,
        "y": 600,
        "wires": []
    },
    {
        "id": "ea3895bffdf0ef9a",
        "type": "inject",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "props": [
            {
                "p": "payload.alarm",
                "v": "true",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 490,
        "y": 600,
        "wires": [
            [
                "beb8cc5d23e06a73"
            ]
        ]
    },
    {
        "id": "29c10c7b22b20fee",
        "type": "change",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload.alarm",
                "pt": "msg",
                "to": "true",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload.duration",
                "pt": "msg",
                "to": "5",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 540,
        "wires": [
            [
                "beb8cc5d23e06a73"
            ]
        ],
        "info": "Based on:\nhttps://www.zigbee2mqtt.io/devices/NAS-AB02B2.html"
    },
    {
        "id": "f1e35a75c0e044b3",
        "type": "mqtt-broker",
        "name": "Garasjelys",
        "broker": "192.168.4.1",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

I would do this by using a node-red-simple-gate to block or allow messages through, and a node-red-contrib-cron-plus node to drive it open/closed. Or if the timer requirements are very simple then just a couple of Inject nodes.

1 Like

Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.