[{"id":"4b59452b.e3455c","type":"tab","label":"TWC Severe Weather Alerts","disabled":false,"info":""},{"id":"facbc77c.ad4008","type":"http request","z":"4b59452b.e3455c","name":"Weather Alert Headlines","method":"GET","ret":"obj","paytoqs":false,"url":"https://api.weather.com/v3/alerts/headlines?countryCode=US&format=json&language=en-US&apiKey={{{apikey}}}","tls":"","proxy":"","authType":"","x":830,"y":180,"wires":[["9c883aac.3461c8","8c485902.c4c868"]]},{"id":"33abec69.4422d4","type":"inject","z":"4b59452b.e3455c","name":"Alert Headlines - US","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":180,"wires":[["a802a853.eefea8"]]},{"id":"9c883aac.3461c8","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":180,"wires":[]},{"id":"25134915.3c7d76","type":"function","z":"4b59452b.e3455c","name":"Next","func":"var Severe = flow.get(\"SevereAlerts\")||[];\n\nfor( i = 0 ; i < msg.payload.alerts.length ; i++ ) {\n if( msg.payload.alerts[i].severityCode >=2 ) {\n Severe.push(msg.payload.alerts[i]) ;\n }\n}\nflow.set(\"SevereAlerts\", Severe);\n\n \n \nif( msg.payload.metadata.next === null ) {\n return [null, msg] ;\n\n \n}else {\n // Get the next chunk of Alerts\n msg.url = 'https://api.weather.com/v3/alerts/headlines?countryCode=US&format=json&language=en-US&apiKey='+msg.apikey;\n msg.url = msg.url + \"&next=\" + msg.payload.metadata.next ;\n\n return [msg, null];\n}\n","outputs":2,"noerr":0,"x":490,"y":280,"wires":[["485da5e4.44b78c"],["af06c8e5.74a298"]]},{"id":"485da5e4.44b78c","type":"http request","z":"4b59452b.e3455c","name":"Next Block of Alerts","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","proxy":"","authType":"","x":690,"y":280,"wires":[["3c017ca3.634c44","25134915.3c7d76"]]},{"id":"3c017ca3.634c44","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":910,"y":280,"wires":[]},{"id":"3e417894.fcf668","type":"comment","z":"4b59452b.e3455c","name":"All US Weather Alerts","info":"","x":280,"y":100,"wires":[]},{"id":"ab655152.9f434","type":"http request","z":"4b59452b.e3455c","name":"Weather Alert Headlines","method":"GET","ret":"obj","paytoqs":false,"url":"https://api.weather.com/v3/alerts/headlines?adminDistrictCode={{{admindistrictcode}}}&format=json&language=en-US&apiKey={{{apikey}}}","tls":"","proxy":"","authType":"","x":870,"y":720,"wires":[["272d2f80.4a291","2e64b72a.11cf78"]]},{"id":"33f0994e.7603c6","type":"inject","z":"4b59452b.e3455c","name":"Alert Headlines NJ:US","topic":"","payload":"NJ:US","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":300,"y":760,"wires":[["faba5ddc.d508b"]]},{"id":"272d2f80.4a291","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1070,"y":720,"wires":[]},{"id":"faba5ddc.d508b","type":"change","z":"4b59452b.e3455c","name":"","rules":[{"t":"delete","p":"SevereAlerts","pt":"flow"},{"t":"set","p":"SevereAlerts","pt":"flow","to":"[]","tot":"json"},{"t":"set","p":"apikey","pt":"msg","to":"twcapikey","tot":"flow"},{"t":"set","p":"admindistrictcode","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"admindistrictcode","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":720,"wires":[["ab655152.9f434","c0dd9d02.e59f9"]]},{"id":"af06c8e5.74a298","type":"change","z":"4b59452b.e3455c","name":"All Severe Alerts","rules":[{"t":"set","p":"payload","pt":"msg","to":"SevereAlerts","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"SevereAlerts","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":340,"wires":[["2ecfa0f7.b76ed","e2f6189a.c36ae8"]]},{"id":"2ecfa0f7.b76ed","type":"debug","z":"4b59452b.e3455c","name":"All Severe","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":900,"y":340,"wires":[]},{"id":"a802a853.eefea8","type":"change","z":"4b59452b.e3455c","name":"","rules":[{"t":"set","p":"apikey","pt":"msg","to":"twcapikey","tot":"flow"},{"t":"delete","p":"SevereAlerts","pt":"flow"},{"t":"set","p":"SevereAlerts","pt":"flow","to":"[]","tot":"json"},{"t":"set","p":"GotAllSevereAlerts","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":180,"wires":[["facbc77c.ad4008"]]},{"id":"762bb04.587f15","type":"function","z":"4b59452b.e3455c","name":"Next","func":"if( typeof msg.payload.alerts == 'undefined' ) {\n // No Severe Alerts for this State / District\n // Blank the table\n msg.payload = [];\n return [null, null, msg] ;\n}\nvar Severe = flow.get(\"SevereAlerts\") ||[];\nseverityCode=flow.get(\"severityCode\") ||2;\n\nfor( i = 0 ; i < msg.payload.alerts.length ; i++ ) {\n if( msg.payload.alerts[i].severityCode >1 ) {\n Severe.push(msg.payload.alerts[i]) ;\n }\n}\n//flow.set(\"SevereAlerts\", Severe);\nmsg.payload=Severe\n\n return [null, msg, null] ;\n \n \n \nif( msg.payload.metadata.next === null ) {\n return [null, msg, null] ;\n} else {\n // Get the next chunk of Alerts\n msg.url = 'https://api.weather.com/v3/alerts/headlines?adminDistrictCode='+msg.admindistrictcode+'&format=json&language=en-US&apiKey='+msg.apikey;\n msg.url = msg.url + \"&next=\" + msg.payload.metadata.next ;\n\n return [msg, null, null];\n}","outputs":3,"noerr":0,"x":490,"y":900,"wires":[["6b741b88.bd4ab4"],["2182d60f.a6709a"],["5dec97f.a5fb068"]]},{"id":"6b741b88.bd4ab4","type":"http request","z":"4b59452b.e3455c","name":"Next Block of Alerts","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","proxy":"","authType":"","x":690,"y":900,"wires":[["762bb04.587f15","40e9cd1.2c05f34"]]},{"id":"40e9cd1.2c05f34","type":"debug","z":"4b59452b.e3455c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1090,"y":900,"wires":[]},{"id":"2182d60f.a6709a","type":"change","z":"4b59452b.e3455c","name":"All Severe Alerts","rules":[{"t":"set","p":"payload","pt":"msg","to":"SevereAlerts","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":960,"wires":[["352f7f78.a38cf","aece44cb.edbcb8","263919fd.8fc4e6"]]},{"id":"352f7f78.a38cf","type":"debug","z":"4b59452b.e3455c","name":"All Severe","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1090,"y":960,"wires":[]},{"id":"e3ee63ee.a3933","type":"change","z":"4b59452b.e3455c","name":"Default map","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"command\":{\"layer\":\"OSM\",\"lat\":41.2417,\"lon\":-99.3829,\"zoom\":4,\"addtoheatmap\":true,\"autopan\":true,\"clear\":\"OSM\",\"map\":{\"name\":\"OSM\",\"url\":\"http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png\",\"opt\":{\"MaxZoom\":18,\"attribution\":\"© OpenStreetMap\"}}}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":1120,"wires":[["52a11509.6e247c"]]},{"id":"52a11509.6e247c","type":"worldmap","z":"4b59452b.e3455c","name":"","lat":"","lon":"","zoom":"","cluster":"","maxage":"","hiderightclick":"false","coords":"none","path":"/alertmap","x":1080,"y":1120,"wires":[]},{"id":"6694fbb0.5116f4","type":"ui_template","z":"4b59452b.e3455c","group":"86d7a681.b44308","name":"Embedded Map","order":1,"width":"18","height":"10","format":"
","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1260,"y":1180,"wires":[[]]},{"id":"c052f5e9.0daf98","type":"template","z":"4b59452b.e3455c","name":"Add Map to Dashboard","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","x":750,"y":1180,"wires":[["6694fbb0.5116f4"]]},{"id":"a10c520f.f311e","type":"change","z":"4b59452b.e3455c","name":"Inject /alertmap","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.url","pt":"msg","to":"\"/alertmap\"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1180,"wires":[["c052f5e9.0daf98"]]},{"id":"d0414b62.6f76b8","type":"delay","z":"4b59452b.e3455c","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":1120,"wires":[["e3ee63ee.a3933"]]},{"id":"51476440.c3440c","type":"inject","z":"4b59452b.e3455c","name":"Init WorldMap","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"2","x":300,"y":1180,"wires":[["d0414b62.6f76b8","a10c520f.f311e"]]},{"id":"68aef7d3.e881c8","type":"comment","z":"4b59452b.e3455c","name":"One time - Add Map to Dashboard","info":"","x":270,"y":1120,"wires":[]},{"id":"a3ae9334.ea8a","type":"function","z":"4b59452b.e3455c","name":"Plot on Map","func":"var newmsg={}\nvar newpayload={}\nnewpayload.lat = msg.payload.latitude;\nnewpayload.lon = msg.payload.longitude;\nnewpayload.name = msg.payload.detailKey;\n//newpayload.areaName =msg.payload.detailKey;\nnewpayload.headlineText=msg.payload.headlineText;\nnewpayload.eventDescription=msg.payload.eventDescription\nnewpayload.severity=msg.payload.severity\nnewpayload.issueTimeLocal=msg.payload.issueTimeLocal\nnewpayload.certainty=msg.payload.certainty\nnewpayload.severityCode=msg.payload.severityCode\nnewpayload.officeAdminDistrict=msg.payload.officeAdminDistrict\n\nmsg.payload.icon = \"globe\";\nif( msg.payload.severityCode > 2 ) {\n newpayload.iconColor = \"red\";\n} else {\n newpayload.iconColor = \"orange\";\n}\n\nnewpayload.command = { zoom:6, \n \"lat\":newpayload.lat,\n \"lon\":newpayload.lon,\n autopan:true };\n\nmsg.payload=newpayload\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":1080,"wires":[["52a11509.6e247c"]]},{"id":"aece44cb.edbcb8","type":"split","z":"4b59452b.e3455c","name":"Split / Plot Alerts","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":520,"y":1080,"wires":[["8ed0ef3c.7dbbf"]]},{"id":"8c485902.c4c868","type":"switch","z":"4b59452b.e3455c","name":"Valid API key?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Access Denied","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":280,"y":240,"wires":[["96a8106d.834ac"],["25134915.3c7d76"]],"info":"If your API key is invalid for this API call, the response will contain:\n\n\nAccess Denied\n\n

Access Denied

\n \nYou don't have permission to access \"http://api.weather.com/v3/alerts/headlines?\" on this server.

\nReference #18.4d3c2b17.1573048691.85dab1a\n\n"},{"id":"2c6ce01e.a96c8","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":910,"y":240,"wires":[]},{"id":"96a8106d.834ac","type":"change","z":"4b59452b.e3455c","name":"Error API Key access denied","rules":[{"t":"set","p":"payload","pt":"msg","to":"Access Denied - Your API key does not have permission to access this API","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":240,"wires":[["2c6ce01e.a96c8"]]},{"id":"2e64b72a.11cf78","type":"switch","z":"4b59452b.e3455c","name":"Valid API key?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Access Denied","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":280,"y":860,"wires":[["d3e884d6.751768"],["762bb04.587f15"]],"info":"If your API key is invalid for this API call, the response will contain:\n\n\nAccess Denied\n\n

Access Denied

\n \nYou don't have permission to access \"http://api.weather.com/v3/alerts/headlines?\" on this server.

\nReference #18.4d3c2b17.1573048691.85dab1a\n\n"},{"id":"d3e884d6.751768","type":"change","z":"4b59452b.e3455c","name":"Error API Key access denied","rules":[{"t":"set","p":"payload","pt":"msg","to":"Access Denied - Your API key does not have permission to access this API","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":840,"wires":[["7c4dfb04.071e14"]]},{"id":"7c4dfb04.071e14","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1090,"y":840,"wires":[]},{"id":"e2f6189a.c36ae8","type":"link out","z":"4b59452b.e3455c","name":"US All Alerts","links":["a6b6d670.743e38"],"x":855,"y":380,"wires":[]},{"id":"a6b6d670.743e38","type":"link in","z":"4b59452b.e3455c","name":"Plot All US Alerts","links":["e2f6189a.c36ae8"],"x":355,"y":1020,"wires":[["263919fd.8fc4e6","aece44cb.edbcb8"]]},{"id":"394784fa.d588ac","type":"ui_dropdown","z":"4b59452b.e3455c","name":"","label":"Select State:","tooltip":"","place":"AK:US","group":"b9c42f64.473f7","order":2,"width":0,"height":0,"passthru":true,"options":[{"label":"AK:US","value":"AK:US","type":"str"}],"payload":"","topic":"","x":670,"y":600,"wires":[["62868f6e.48a9f","67363b53.677574","e65a1ef7.9d95"]]},{"id":"bdc5e044.ac349","type":"change","z":"4b59452b.e3455c","name":"Load States","rules":[{"t":"set","p":"junk","pt":"msg","to":"[{\"Alaska\":\"AK:US\"},{\"Alabama\":\"AL:US\"},{\"Arkansas\":\"AR:US\"},{\"American Samoa\":\"AS:US\"},{\"Arizona\":\"AZ:US\"},{\"California\":\"CA:US\"},{\"Colorado\":\"CO:US\"},{\"Connecticut\":\"CT:US\"},{\"District of Columbia\":\"DC:US\"},{\"Delaware\":\"DE:US\"},{\"Florida\":\"FL:US\"},{\"Georgia\":\"GA:US\"},{\"Guam\":\"GU:US\"},{\"Hawaii\":\"HI:US\"},{\"Iowa\":\"IA:US\"},{\"Idaho\":\"ID:US\"},{\"Illinois\":\"IL:US\"},{\"Indiana\":\"IN:US\"},{\"Kansas\":\"KS:US\"},{\"Kentucky\":\"KY:US\"},{\"Louisiana\":\"LA:US\"},{\"Massachusetts\":\"MA:US\"},{\"Maryland\":\"MD:US\"},{\"Maine\":\"ME:US\"},{\"Michigan\":\"MI:US\"},{\"Minnesota\":\"MN:US\"},{\"Missouri\":\"MO:US\"},{\"Mississippi\":\"MS:US\"},{\"Montana\":\"MT:US\"},{\"North Carolina\":\"NC:US\"},{\"North Dakota\":\"ND:US\"},{\"Nebraska\":\"NE:US\"},{\"New Hampshire\":\"NH:US\"},{\"New Jersey\":\"NJ:US\"},{\"New Mexico\":\"NM:US\"},{\"Nevada\":\"NV:US\"},{\"New York\":\"NY:US\"},{\"Ohio\":\"OH:US\"},{\"Oklahoma\":\"OK:US\"},{\"Oregon\":\"OR:US\"},{\"Pennsylvania\":\"PA:US\"},{\"Puerto Rico\":\"PR:US\"},{\"Rhode Island\":\"RI:US\"},{\"South Carolina\":\"SC:US\"},{\"South Dakota\":\"SD:US\"},{\"Tennessee\":\"TN:US\"},{\"Texas\":\"TX:US\"},{\"Utah\":\"UT:US\"},{\"Virginia\":\"VA:US\"},{\"Virgin Islands\":\"VI:US\"},{\"Vermont\":\"VT:US\"},{\"Washington\":\"WA:US\"},{\"Wisconsin\":\"WI:US\"},{\"West Virginia\":\"WV:US\"},{\"Wyoming\":\"WY:US\"}]","tot":"json"},{"t":"set","p":"options","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":560,"wires":[["7884fbf8.953554","394784fa.d588ac"]]},{"id":"7884fbf8.953554","type":"debug","z":"4b59452b.e3455c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"options","targetType":"msg","x":670,"y":560,"wires":[]},{"id":"acd786d3.812818","type":"inject","z":"4b59452b.e3455c","name":"","topic":"","payload":"[{\"Alaska\":\"AK:US\"},{\"Alabama\":\"AL:US\"},{\"Arkansas\":\"AR:US\"},{\"American Samoa\":\"AS:US\"},{\"Arizona\":\"AZ:US\"},{\"California\":\"CA:US\"},{\"Colorado\":\"CO:US\"},{\"Connecticut\":\"CT:US\"},{\"District of Columbia\":\"DC:US\"},{\"Delaware\":\"DE:US\"},{\"Florida\":\"FL:US\"},{\"Georgia\":\"GA:US\"},{\"Guam\":\"GU:US\"},{\"Hawaii\":\"HI:US\"},{\"Iowa\":\"IA:US\"},{\"Idaho\":\"ID:US\"},{\"Illinois\":\"IL:US\"},{\"Indiana\":\"IN:US\"},{\"Kansas\":\"KS:US\"},{\"Kentucky\":\"KY:US\"},{\"Louisiana\":\"LA:US\"},{\"Massachusetts\":\"MA:US\"},{\"Maryland\":\"MD:US\"},{\"Maine\":\"ME:US\"},{\"Michigan\":\"MI:US\"},{\"Minnesota\":\"MN:US\"},{\"Missouri\":\"MO:US\"},{\"Mississippi\":\"MS:US\"},{\"Montana\":\"MT:US\"},{\"North Carolina\":\"NC:US\"},{\"North Dakota\":\"ND:US\"},{\"Nebraska\":\"NE:US\"},{\"New Hampshire\":\"NH:US\"},{\"New Jersey\":\"NJ:US\"},{\"New Mexico\":\"NM:US\"},{\"Nevada\":\"NV:US\"},{\"New York\":\"NY:US\"},{\"Ohio\":\"OH:US\"},{\"Oklahoma\":\"OK:US\"},{\"Oregon\":\"OR:US\"},{\"Pennsylvania\":\"PA:US\"},{\"Puerto Rico\":\"PR:US\"},{\"Rhode Island\":\"RI:US\"},{\"South Carolina\":\"SC:US\"},{\"South Dakota\":\"SD:US\"},{\"Tennessee\":\"TN:US\"},{\"Texas\":\"TX:US\"},{\"Utah\":\"UT:US\"},{\"Virginia\":\"VA:US\"},{\"Virgin Islands\":\"VI:US\"},{\"Vermont\":\"VT:US\"},{\"Washington\":\"WA:US\"},{\"Wisconsin\":\"WI:US\"},{\"West Virginia\":\"WV:US\"},{\"Wyoming\":\"WY:US\"}]","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"1","x":250,"y":560,"wires":[["bdc5e044.ac349"]]},{"id":"62868f6e.48a9f","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1070,"y":600,"wires":[]},{"id":"67363b53.677574","type":"switch","z":"4b59452b.e3455c","name":"Which State Selected?","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":300,"y":720,"wires":[["7993aa1f.787aa4"]]},{"id":"ddbd43b0.3e2d5","type":"comment","z":"4b59452b.e3455c","name":"Select States - Weather Alerts","info":"","x":300,"y":520,"wires":[]},{"id":"5dec97f.a5fb068","type":"ui_table","z":"4b59452b.e3455c","group":"b9c42f64.473f7","name":"","order":3,"width":"8","height":"7","columns":[{"field":"severityCode","title":"Severity","width":"5%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"location","title":"Location","width":"30%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"headline","title":"Headline","width":"65%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":1070,"y":1040,"wires":[["a99e5eef.a8f0a","984f1594.25c938","3fb1f711.f42c48"]]},{"id":"263919fd.8fc4e6","type":"function","z":"4b59452b.e3455c","name":"Build Table","func":"var TableArray = [];\nfor( i=0; i < msg.payload.length; i++ ) {\n var TableEntry = {};\n TableEntry.severityCode = msg.payload[i].severityCode ;\n TableEntry.location = msg.payload[i].areaName ;\n TableEntry.headline = msg.payload[i].headlineText ;\n TableEntry.latitude = msg.payload[i].latitude ;\n TableEntry.longitude = msg.payload[i].longitude ;\n // node.warn( TableEntry ) ;\n TableArray.push( TableEntry );\n}\n\nmsg.payload = TableArray;\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":1020,"wires":[["f80e6fb7.db4f2","5dec97f.a5fb068"]]},{"id":"f80e6fb7.db4f2","type":"debug","z":"4b59452b.e3455c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1090,"y":1000,"wires":[]},{"id":"a99e5eef.a8f0a","type":"debug","z":"4b59452b.e3455c","name":"onClick","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1360,"y":1100,"wires":[]},{"id":"984f1594.25c938","type":"change","z":"4b59452b.e3455c","name":"Zoom Map on Click","rules":[{"t":"move","p":"payload","pt":"msg","to":"tmp","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.command","pt":"msg","to":"{\"zoom\":10,\"autopan\":true}","tot":"json"},{"t":"set","p":"payload.command.lat","pt":"msg","to":"tmp.latitude","tot":"msg"},{"t":"set","p":"payload.command.lon","pt":"msg","to":"tmp.longitude","tot":"msg"},{"t":"delete","p":"tmp","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":1000,"wires":[["52a11509.6e247c"]],"info":"Essentially create this:\n\nmsg.payload.command = { zoom:6, \n \"lat\":msg.payload.latitude,\n \"lon\":msg.payload.longitude\n autopan:true };"},{"id":"2f67563e.3ca3ba","type":"ui_button","z":"4b59452b.e3455c","name":"","group":"b9c42f64.473f7","order":1,"width":0,"height":0,"passthru":false,"label":"Show all US Severe Weather Alerts","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":320,"y":140,"wires":[["a802a853.eefea8"]]},{"id":"3fb1f711.f42c48","type":"ui_text","z":"4b59452b.e3455c","group":"86d7a681.b44308","order":2,"width":"22","height":"1","name":"Headline","label":"","format":"{{msg.payload.headline}}","layout":"row-left","x":1360,"y":1060,"wires":[]},{"id":"8ed0ef3c.7dbbf","type":"delay","z":"4b59452b.e3455c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"20","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":720,"y":1080,"wires":[["a3ae9334.ea8a"]]},{"id":"72bd1b88.45f954","type":"change","z":"4b59452b.e3455c","name":"Set TWC API Key here","rules":[{"t":"set","p":"twcapikey","pt":"flow","to":"<<>>>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":60,"wires":[["d5e88df4.33e9d"]]},{"id":"918390dc.4ab1","type":"inject","z":"4b59452b.e3455c","name":"Init TWC API Key","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":290,"y":60,"wires":[["72bd1b88.45f954"]]},{"id":"787c9920.e6fd08","type":"inject","z":"4b59452b.e3455c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":780,"y":120,"wires":[["facbc77c.ad4008"]]},{"id":"e65a1ef7.9d95","type":"function","z":"4b59452b.e3455c","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":540,"wires":[["6614e3da.3894cc"]]},{"id":"6614e3da.3894cc","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1090,"y":540,"wires":[]},{"id":"d5e88df4.33e9d","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":60,"wires":[]},{"id":"8a67e8dd.3394d8","type":"ui_dropdown","z":"4b59452b.e3455c","name":"","label":"Servity Filter:","tooltip":"","place":"0","group":"b9c42f64.473f7","order":2,"width":0,"height":0,"passthru":true,"options":[{"label":"1","value":"1","type":"str"},{"label":"2","value":"2","type":"str"},{"label":"3","value":"3","type":"str"},{"label":"4","value":"4","type":"str"},{"label":"5","value":"5","type":"str"},{"label":"ALL","value":"0","type":"str"}],"payload":"","topic":"","x":270,"y":480,"wires":[["4e3d24e8.d7e04c"]]},{"id":"4e3d24e8.d7e04c","type":"function","z":"4b59452b.e3455c","name":"","func":"flow.set(\"severityCode\", parseInt(msg.payload))\nmsg.severityCode=flow.get(\"severityCode\")\nmsg.SevereAlerts=flow.get(\"SevereAlerts\") ;\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":480,"wires":[["ca9b390.4bcb9c8","48224fb5.217d4"]]},{"id":"ca9b390.4bcb9c8","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":480,"wires":[]},{"id":"8c456511.2681b8","type":"inject","z":"4b59452b.e3455c","name":"","topic":"","payload":"3","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":400,"wires":[["8a67e8dd.3394d8"]]},{"id":"48224fb5.217d4","type":"function","z":"4b59452b.e3455c","name":"Next","func":"\nvar mySevere=[]\nvar Severe = flow.get(\"SevereAlerts\") ;\nseverityCode=flow.get(\"severityCode\");\n\nif (severityCode == 0)\n{\nmsg.payload=[]\nmsg.payload=Severe;\nreturn msg\n}\nfor( i = 0 ; i < Severe.length ; i++ ) {\n if( Severe[i].severityCode == severityCode ) {\n mySevere.push(Severe[i]) ;\n }\n}\n\nmsg.payload=mySevere\n\n\n\n\n\nreturn msg\n \n ","outputs":1,"noerr":0,"x":210,"y":960,"wires":[["80ce923f.28f78","263919fd.8fc4e6"]]},{"id":"80ce923f.28f78","type":"debug","z":"4b59452b.e3455c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":160,"y":1020,"wires":[]},{"id":"4d6534dd.3e458c","type":"inject","z":"4b59452b.e3455c","name":"","topic":"","payload":"2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":360,"wires":[["8a67e8dd.3394d8"]]},{"id":"8ed4f08c.1fbdf","type":"comment","z":"4b59452b.e3455c","name":"Filter the Levels/Tables","info":"","x":320,"y":440,"wires":[]},{"id":"800bd1a3.ea6fd","type":"comment","z":"4b59452b.e3455c","name":"Thought... if once click get all we can save the API call","info":"","x":1040,"y":680,"wires":[]},{"id":"117c15db.e954ca","type":"ui_button","z":"4b59452b.e3455c","name":"","group":"b9c42f64.473f7","order":1,"width":0,"height":0,"passthru":false,"label":"Clear Alerts","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":250,"y":1260,"wires":[["82019e7.313626"]]},{"id":"82019e7.313626","type":"change","z":"4b59452b.e3455c","name":"","rules":[{"t":"delete","p":"SevereAlerts","pt":"flow"},{"t":"set","p":"GotAllSevereAlerts","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1260,"wires":[["7a924b91.a82224"]]},{"id":"7a924b91.a82224","type":"change","z":"4b59452b.e3455c","name":"Default map","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":{\"clear\":\"OSM\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":1260,"wires":[["2fb6e636.ec6a8a","66e32b08.93ac54"]]},{"id":"7c424b19.4fba84","type":"inject","z":"4b59452b.e3455c","name":"Init WorldMap","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":"2","x":430,"y":1380,"wires":[["7a924b91.a82224"]]},{"id":"c0dd9d02.e59f9","type":"function","z":"4b59452b.e3455c","name":"","func":"msg.url=\"https://api.weather.com/v3/alerts/headlines?adminDistrictCode=\"+msg.admindistrictcode+\"&format=json&language=en-US&apiKey=\"+msg.apikey\n\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":800,"wires":[["272d2f80.4a291"]]},{"id":"7993aa1f.787aa4","type":"switch","z":"4b59452b.e3455c","name":"","property":"GotAllSevereAlerts","propertyType":"flow","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":760,"wires":[["faba5ddc.d508b"],["48224fb5.217d4"]]},{"id":"2fb6e636.ec6a8a","type":"function","z":"4b59452b.e3455c","name":"Clear Map/Table","func":"msg.payload=[];\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":1260,"wires":[["5dec97f.a5fb068","6694fbb0.5116f4"]]},{"id":"66e32b08.93ac54","type":"function","z":"4b59452b.e3455c","name":"Clear Map/Table","func":"msg.payload.command.clear = \"OSM\"\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":1380,"wires":[["52a11509.6e247c","5dae115c.977dc"]]},{"id":"5dae115c.977dc","type":"change","z":"4b59452b.e3455c","name":"Default map","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"command\":{\"layer\":\"OSM\",\"lat\":41.2417,\"lon\":-99.3829,\"zoom\":4,\"addtoheatmap\":true,\"autopan\":true,\"clear\":\"OSM\",\"map\":{\"name\":\"OSM\",\"url\":\"http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png\",\"opt\":{\"MaxZoom\":18,\"attribution\":\"© OpenStreetMap\"}}}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":1360,"wires":[["52a11509.6e247c"]]},{"id":"da4bfa7c.928648","type":"comment","z":"4b59452b.e3455c","name":"Mvk Changes","info":"02-April-2020 - added somefilters and limited the APIS calls ","x":1250,"y":320,"wires":[]},{"id":"86d7a681.b44308","type":"ui_group","z":"","name":"Alert Map","tab":"fd5bcf84.9357b","order":2,"disp":true,"width":"22","collapse":false},{"id":"b9c42f64.473f7","type":"ui_group","z":"","name":"Get Alerts","tab":"fd5bcf84.9357b","order":1,"disp":true,"width":"8","collapse":false},{"id":"fd5bcf84.9357b","type":"ui_tab","z":"","name":"Severe Weather Alert Headlines","icon":"dashboard","order":1,"disabled":false,"hidden":false}]