node-red-contrib-chronos
Version:
Time-based Node-RED scheduling, repeating, queueing, routing, filtering and manipulating nodes
157 lines (156 loc) • 3.88 kB
JSON
[
{
"id": "671609705841dfab",
"type": "tab",
"label": "External input",
"disabled": false,
"info": "",
"env": []
},
{
"id": "04b2823017743f50",
"type": "comment",
"z": "671609705841dfab",
"name": "",
"info": "# Context condition\nFetch a condition from a global context variable.\n\n## Conditions\n- (from context variable `global.condition`) between end of sunset minus 15 minutes (randomized) and 22:30",
"x": 120,
"y": 60,
"wires": []
},
{
"id": "806dd38711a1c66b",
"type": "inject",
"z": "671609705841dfab",
"name": "input message",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Look at the context!",
"payloadType": "str",
"x": 160,
"y": 140,
"wires": [
[
"12dbcbe90c02fd14"
]
]
},
{
"id": "12dbcbe90c02fd14",
"type": "chronos-filter",
"z": "671609705841dfab",
"name": "from context",
"config": "5e581578.25c88c",
"baseTime": "",
"baseTimeType": "msgIngress",
"evaluation": "",
"evaluationType": "or",
"conditions": [
{
"operator": "context",
"context": {
"value": "condition",
"type": "global"
}
}
],
"x": 390,
"y": 140,
"wires": [
[
"1ae9c7a084478411"
]
]
},
{
"id": "1ae9c7a084478411",
"type": "debug",
"z": "671609705841dfab",
"name": "between Sunset (end) - ~15 minutes and 22:30",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 140,
"wires": []
},
{
"id": "f240c12ac9543c3a",
"type": "inject",
"z": "671609705841dfab",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "date",
"x": 140,
"y": 240,
"wires": [
[
"4f6fc5f90c03abaa"
]
]
},
{
"id": "4f6fc5f90c03abaa",
"type": "change",
"z": "671609705841dfab",
"name": "set env variable",
"rules": [
{
"t": "set",
"p": "condition",
"pt": "global",
"to": "{\"operator\":\"between\",\"operands\":[{\"type\":\"sun\",\"value\":\"sunset\",\"offset\":-15,\"random\":true},{\"type\":\"time\",\"value\":\"22:30\",\"offset\":0,\"random\":false}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 360,
"y": 240,
"wires": [
[]
]
},
{
"id": "5e581578.25c88c",
"type": "chronos-config",
"name": "Berlin",
"timezone": "",
"sunPositions": [
{
"angle": -4,
"riseName": "blueHourDawn",
"setName": "blueHourDusk"
},
{
"angle": -8,
"riseName": "blueHourDawnBegin",
"setName": "blueHourDuskEnd"
}
]
}
]