Skip to content

Instantly share code, notes, and snippets.

@Naesstrom
Created August 8, 2019 12:33
Show Gist options
  • Save Naesstrom/bb993a05a7f4390180636298ebf9c868 to your computer and use it in GitHub Desktop.
Save Naesstrom/bb993a05a7f4390180636298ebf9c868 to your computer and use it in GitHub Desktop.
[
{
"id": "a39f58b2.f48ca8",
"type": "tab",
"label": "Weather warnings",
"disabled": false,
"info": ""
},
{
"id": "fa47dc61.cf8ff",
"type": "debug",
"z": "a39f58b2.f48ca8",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 668,
"y": 219,
"wires": []
},
{
"id": "dc618044.45b8a",
"type": "inject",
"z": "a39f58b2.f48ca8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "600",
"crontab": "",
"once": true,
"onceDelay": "",
"x": 155,
"y": 307,
"wires": [
[
"4ec120a5.591ff"
]
]
},
{
"id": "4ec120a5.591ff",
"type": "http request",
"z": "a39f58b2.f48ca8",
"name": "SMHI Alerts",
"method": "GET",
"ret": "txt",
"url": "https://opendata-download-warnings.smhi.se/api/version/2/alerts.json",
"tls": "",
"x": 312,
"y": 307,
"wires": [
[
"b678db1e.d99348"
]
]
},
{
"id": "b678db1e.d99348",
"type": "json",
"z": "a39f58b2.f48ca8",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 521,
"y": 306,
"wires": [
[
"acd457a0.e4c0f8",
"9f9a0969.b9ff78"
]
]
},
{
"id": "acd457a0.e4c0f8",
"type": "split",
"z": "a39f58b2.f48ca8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": "4",
"arraySpltType": "len",
"stream": false,
"addname": "test",
"x": 685,
"y": 306,
"wires": [
[
"fa47dc61.cf8ff",
"2693081.5f79bf8"
]
]
},
{
"id": "9f9a0969.b9ff78",
"type": "debug",
"z": "a39f58b2.f48ca8",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 496,
"y": 201,
"wires": []
},
{
"id": "2693081.5f79bf8",
"type": "split",
"z": "a39f58b2.f48ca8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 874,
"y": 306,
"wires": [
[
"adabe8e4.551088",
"ea9a3202.a79f4"
]
]
},
{
"id": "adabe8e4.551088",
"type": "debug",
"z": "a39f58b2.f48ca8",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 865,
"y": 222,
"wires": []
},
{
"id": "c9e7bbbd.1b5ac8",
"type": "debug",
"z": "a39f58b2.f48ca8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1040,
"y": 223,
"wires": []
},
{
"id": "ea9a3202.a79f4",
"type": "switch",
"z": "a39f58b2.f48ca8",
"name": "",
"property": "payload.info.area.areaDesc",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "018",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1051,
"y": 306,
"wires": [
[
"c9e7bbbd.1b5ac8",
"3fe3599f.82c9d6"
]
]
},
{
"id": "3fe3599f.82c9d6",
"type": "change",
"z": "a39f58b2.f48ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.info",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1248,
"y": 305,
"wires": [
[
"b7e25161.c12f5",
"15a2333.38833cd"
]
]
},
{
"id": "b7e25161.c12f5",
"type": "debug",
"z": "a39f58b2.f48ca8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1456,
"y": 227,
"wires": []
},
{
"id": "15a2333.38833cd",
"type": "mqtt out",
"z": "a39f58b2.f48ca8",
"name": "warning",
"topic": "/SMHI/warning/",
"qos": "0",
"retain": "",
"broker": "ba80ab3d.961428",
"x": 1450,
"y": 305,
"wires": []
},
{
"id": "e716ceaf.14f81",
"type": "comment",
"z": "a39f58b2.f48ca8",
"name": "Convert",
"info": "",
"x": 518,
"y": 354,
"wires": []
},
{
"id": "80eb76c3.fc8c68",
"type": "comment",
"z": "a39f58b2.f48ca8",
"name": "Split to alerts",
"info": "",
"x": 675,
"y": 357,
"wires": []
},
{
"id": "52e176e5.633198",
"type": "comment",
"z": "a39f58b2.f48ca8",
"name": "Split even further",
"info": "",
"x": 862,
"y": 357,
"wires": []
},
{
"id": "acb45066.e94d5",
"type": "comment",
"z": "a39f58b2.f48ca8",
"name": "Enter Area Code",
"info": "Find your area code from the json here\nhttps://opendata-download-warnings.smhi.se/api/version/2/districtviews/all.json\nEnter area code in node to filter only your area",
"x": 1036,
"y": 358,
"wires": []
},
{
"id": "ba80ab3d.961428",
"type": "mqtt-broker",
"z": "",
"name": "Katrinelund",
"broker": "https://192.168.1.119",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment