Skip to content

Timer and watchdog

cflurin edited this page Aug 10, 2018 · 4 revisions

timer

Configuration:

{
    "data": {
        "delay1": 1000,
        "delay2": 2000
    },
    "methods": {
        "delay1": {
            "name": "setData"
        },
        "delay2": {
            "name": "setData"
        },
        "timer1": {
            "name": "timer",
            "param": "delay1"
        },
        "timer2": {
            "name": "timer",
            "param": "delay2",
            "do": "node.status({});"
        },
        "timer3": {
            "name": "timer",
            "param": 3000,
            "send": {
                "get": "'time over - '+msg.payload;"
            }
        },
        "resetTimer3": {
            "name": "resetTimer",
            "param": "timer3"
        },
        "watchdog1": {
            "name": "watchdog",
            "param": 5000
        },
        "status": {
            "fill": "blue",
            "shape": "dot",
            "text": {
                "get": "msg.topic"
            }
        }
    }
}

Flow:

[{"id":"72094f68.82658","type":"dsm","z":"57ef434a.058a6c","name":"timer","sm_config":"{\n    \"data\": {\n        \"delay1\": 1000,\n        \"delay2\": 2000\n    },\n    \"methods\": {\n        \"delay1\": {\n            \"name\": \"setData\"\n        },\n        \"delay2\": {\n            \"name\": \"setData\"\n        },\n        \"timer1\": {\n            \"name\": \"timer\",\n            \"param\": \"delay1\"\n        },\n        \"timer2\": {\n            \"name\": \"timer\",\n            \"param\": \"delay2\",\n            \"do\": \"node.status({});\"\n        },\n        \"timer3\": {\n            \"name\": \"timer\",\n            \"param\": 3000,\n            \"send\": {\n                \"get\": \"'time over - '+msg.payload;\"\n            }\n        },\n        \"resetTimer3\": {\n            \"name\": \"resetTimer\",\n            \"param\": \"timer3\"\n        },\n        \"watchdog1\": {\n            \"name\": \"watchdog\",\n            \"param\": 5000\n        },\n        \"status\": {\n            \"fill\": \"blue\",\n            \"shape\": \"dot\",\n            \"text\": {\n                \"get\": \"msg.topic\"\n            }\n        }\n    }\n}\n","x":360,"y":3700,"wires":[["9f113252.681de"]]},{"id":"2682e9fc.3d7856","type":"inject","z":"57ef434a.058a6c","name":"","topic":"delay1","payload":"3000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":3680,"wires":[["72094f68.82658"]]},{"id":"d81b7c.dc3a8488","type":"inject","z":"57ef434a.058a6c","name":"","topic":"delay2","payload":"4000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":111,"y":3718,"wires":[["72094f68.82658"]]},{"id":"9f113252.681de","type":"debug","z":"57ef434a.058a6c","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","x":510,"y":3700,"wires":[]},{"id":"48bf8a5d.2e9584","type":"inject","z":"57ef434a.058a6c","name":"","topic":"timer1","payload":"delayed msg 1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":3760,"wires":[["72094f68.82658"]]},{"id":"d13d7f5a.ffcf7","type":"inject","z":"57ef434a.058a6c","name":"","topic":"timer2","payload":"delayed msg 2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":3800,"wires":[["72094f68.82658"]]},{"id":"f8f601f7.28bdd","type":"inject","z":"57ef434a.058a6c","name":"","topic":"timer3","payload":"delayed msg 3","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":3840,"wires":[["72094f68.82658"]]},{"id":"41fee576.06d1cc","type":"inject","z":"57ef434a.058a6c","name":"","topic":"watchdog1","payload":"timeout","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":3920,"wires":[["72094f68.82658"]]},{"id":"db17329.f1101d","type":"inject","z":"57ef434a.058a6c","name":"","topic":"resetTimer3","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":3880,"wires":[["72094f68.82658"]]}]
Clone this wiki locally