Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
8dd7771eee
|
|||
c63adaa68d
|
|||
3c092bf519
|
|||
19e0e35bf4
|
|||
b9a296d312
|
|||
503776de4a
|
|||
e37e4d7718
|
@ -53,8 +53,7 @@ node.log("Kallen Bedroom: Decision Logic Complete")
|
||||
|
||||
let sendFan = {
|
||||
"payload": {
|
||||
"domain": "fan",
|
||||
"service": setFan,
|
||||
"action": "fan." + setFan,
|
||||
"target": {
|
||||
"entity_id": ["fan.kallen_bedroom_fan"]
|
||||
},
|
||||
@ -64,8 +63,7 @@ let sendFan = {
|
||||
|
||||
let sendWhiteNoise = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": setWhiteNoise,
|
||||
"action": "input_boolean." + setWhiteNoise,
|
||||
"target": {
|
||||
"entity_id": ["input_boolean.white_noise_kallen_bedroom"]
|
||||
},
|
||||
@ -75,8 +73,7 @@ let sendWhiteNoise = {
|
||||
|
||||
let sendVolume = {
|
||||
"payload": {
|
||||
"domain": "media_player",
|
||||
"service": "volume_set",
|
||||
"action": "media_player.volume_set",
|
||||
"target": {
|
||||
"entity_id": ["media_player.kallen_bedroom_google_speaker"]
|
||||
},
|
||||
@ -88,8 +85,7 @@ let sendVolume = {
|
||||
|
||||
let sendLights = {
|
||||
"payload": {
|
||||
"domain": "light",
|
||||
"service": setLights,
|
||||
"action": "light." + setLights,
|
||||
"target": {
|
||||
"entity_id": ["light.kallen_bedroom_lights"]
|
||||
},
|
||||
@ -99,8 +95,7 @@ let sendLights = {
|
||||
|
||||
let sendWake = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": setWake,
|
||||
"action": "input_boolean." + setWake,
|
||||
"target": {
|
||||
"entity_id": ["input_boolean.kallen_awake"]
|
||||
},
|
||||
|
@ -12,8 +12,7 @@ let setFan = 'turn_off'
|
||||
|
||||
let sendFan = {
|
||||
"payload": {
|
||||
"domain": "fan",
|
||||
"service": setFan,
|
||||
"action": "fan." + setFan,
|
||||
"target": {
|
||||
"entity_id": ["fan.master_bedroom_fan"]
|
||||
},
|
||||
@ -23,8 +22,7 @@ let sendFan = {
|
||||
|
||||
let sendHvac = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_hvac_mode",
|
||||
"action": "climate.set_hvac_mode",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -36,8 +34,7 @@ let sendHvac = {
|
||||
|
||||
let sendTemp = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_temperature",
|
||||
"action": "climate.set_temperature",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -49,8 +46,7 @@ let sendTemp = {
|
||||
|
||||
let sendEco = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_preset_mode",
|
||||
"action": "climate.set_preset_mode",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -62,8 +58,7 @@ let sendEco = {
|
||||
|
||||
let sendAcFan = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_fan_mode",
|
||||
"action": "climate.set_fan_mode",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
|
@ -183,8 +183,7 @@ node.log("Master Bedroom Climate: Decision Logic Complete")
|
||||
|
||||
let sendFan = {
|
||||
"payload": {
|
||||
"domain": "fan",
|
||||
"service": setFan,
|
||||
"action": "fan." + setFan,
|
||||
"target": {
|
||||
"entity_id": ["fan.master_bedroom_fan"]
|
||||
},
|
||||
@ -194,8 +193,7 @@ let sendFan = {
|
||||
|
||||
let sendCool = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": setCool,
|
||||
"action": "input_boolean." + setCool,
|
||||
"target": {
|
||||
"entity_id": ["input_boolean.master_bedroom_cooling_on"]
|
||||
},
|
||||
@ -205,8 +203,7 @@ let sendCool = {
|
||||
|
||||
let sendSleep = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": setSleep,
|
||||
"action": "input_boolean." + setSleep,
|
||||
"target": {
|
||||
"entity_id": ["input_boolean.master_bedroom_sleeping"]
|
||||
},
|
||||
@ -216,8 +213,7 @@ let sendSleep = {
|
||||
|
||||
let sendPeople = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": setPeople,
|
||||
"action": "input_boolean." + setPeople,
|
||||
"target": {
|
||||
"entity_id": ["input_boolean.tony_awake","input_boolean.tina_awake"]
|
||||
},
|
||||
@ -227,8 +223,7 @@ let sendPeople = {
|
||||
|
||||
let sendDisplay = {
|
||||
"payload": {
|
||||
"domain": "switch",
|
||||
"service": setDisplay,
|
||||
"action": "switch." + setDisplay,
|
||||
"target": {
|
||||
"entity_id": ["switch.master_bedroom_aircon_display"]
|
||||
},
|
||||
@ -245,16 +240,14 @@ let notify = {
|
||||
|
||||
let sendBriefing = {
|
||||
"payload": {
|
||||
"domain": "script",
|
||||
"service": setBriefing
|
||||
"action": "script." + setBriefing,
|
||||
},
|
||||
"delay": setBriefingDelay
|
||||
}
|
||||
|
||||
let sendHvac = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_hvac_mode",
|
||||
"action": "climate.set_hvac_mode",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -266,8 +259,7 @@ let sendHvac = {
|
||||
|
||||
let sendTemp = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_temperature",
|
||||
"action": "climate.set_temperature",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -279,8 +271,7 @@ let sendTemp = {
|
||||
|
||||
let sendEco = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_preset_mode",
|
||||
"action": "climate.set_preset_mode",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -292,8 +283,7 @@ let sendEco = {
|
||||
|
||||
let sendAcFan = {
|
||||
"payload": {
|
||||
"domain": "climate",
|
||||
"service": "set_fan_mode",
|
||||
"action": "climate.set_fan_mode",
|
||||
"target": {
|
||||
"entity_id": ["climate.master_bedroom_aircon"]
|
||||
},
|
||||
@ -305,8 +295,7 @@ let sendAcFan = {
|
||||
|
||||
let sendEchoDotDND = {
|
||||
"payload": {
|
||||
"domain": "switch",
|
||||
"service": echoDotService,
|
||||
"action": "switch." + echoDotService,
|
||||
"target": {
|
||||
"entity_id": ["switch.basement_echo_dot_do_not_disturb_switch"]
|
||||
},
|
||||
|
@ -68,8 +68,7 @@ if (payload === 'start') {
|
||||
// Prepare message payloads
|
||||
let sendTimerStart = {
|
||||
"payload": {
|
||||
"domain": "timer",
|
||||
"service": "start",
|
||||
"action": "timer.start",
|
||||
"target": {
|
||||
"entity_id": timerEntity
|
||||
},
|
||||
@ -81,8 +80,7 @@ let sendTimerStart = {
|
||||
|
||||
let sendTimerCancel = {
|
||||
"payload": {
|
||||
"domain": "timer",
|
||||
"service": "cancel",
|
||||
"action": "timer.cancel",
|
||||
"target": {
|
||||
"entity_id": timerEntity
|
||||
},
|
||||
@ -92,8 +90,7 @@ let sendTimerCancel = {
|
||||
|
||||
let sendBoolFinished = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": servFinished,
|
||||
"action": "input_boolean." + servFinished,
|
||||
"target": {
|
||||
"entity_id": boolFinished
|
||||
},
|
||||
@ -103,8 +100,7 @@ let sendBoolFinished = {
|
||||
|
||||
let sendDateTimeFinished = {
|
||||
"payload": {
|
||||
"domain": "input_datetime",
|
||||
"service": "set_datetime",
|
||||
"action": "input_datetime.set_datetime",
|
||||
"target": {
|
||||
"entity_id": dateTimeEntity
|
||||
},
|
||||
|
@ -127,8 +127,7 @@ node.log("Time-based Automations: Decision Logic Complete")
|
||||
// ---------- Service Calls ----------
|
||||
let sendLights = {
|
||||
"payload": {
|
||||
"domain": "light",
|
||||
"service": "turn_off",
|
||||
"action": "light.turn_off",
|
||||
"target": {
|
||||
"entity_id": lightsOff
|
||||
},
|
||||
@ -138,8 +137,7 @@ let sendLights = {
|
||||
|
||||
let sendSleepOff = {
|
||||
"payload": {
|
||||
"domain": "switch",
|
||||
"service": "turn_off",
|
||||
"action": "switch.turn_off",
|
||||
"target": {
|
||||
"entity_id": adaptiveSleep
|
||||
},
|
||||
@ -149,8 +147,7 @@ let sendSleepOff = {
|
||||
|
||||
let sendBooleanOff = {
|
||||
"payload": {
|
||||
"domain": "input_boolean",
|
||||
"service": "turn_off",
|
||||
"action": "input_boolean.turn_off",
|
||||
"target": {
|
||||
"entity_id": booleanOff
|
||||
},
|
||||
@ -160,8 +157,7 @@ let sendBooleanOff = {
|
||||
|
||||
let sendAdaptive = {
|
||||
"payload": {
|
||||
"domain": "switch",
|
||||
"service": "turn_" + setAdaptive,
|
||||
"action": "switch.turn_" + setAdaptive,
|
||||
"target": {
|
||||
"entity_id": switchAdaptive
|
||||
},
|
||||
@ -171,8 +167,7 @@ let sendAdaptive = {
|
||||
|
||||
let sendSceneResetMain = {
|
||||
"payload": {
|
||||
"domain": "input_text",
|
||||
"service": "set_value",
|
||||
"action": "input_text.set_value",
|
||||
"target": {
|
||||
"entity_id": selScenesMain
|
||||
},
|
||||
@ -184,8 +179,7 @@ let sendSceneResetMain = {
|
||||
|
||||
let sendSceneResetDesk = {
|
||||
"payload": {
|
||||
"domain": "input_text",
|
||||
"service": "set_value",
|
||||
"action": "input_text.set_value",
|
||||
"target": {
|
||||
"entity_id": selScenesTinaDesk
|
||||
},
|
||||
@ -197,8 +191,7 @@ let sendSceneResetDesk = {
|
||||
|
||||
let sendHoliday = {
|
||||
"payload": {
|
||||
"domain": "switch",
|
||||
"service": "turn_" + setHoliday,
|
||||
"action": "switch.turn_" + setHoliday,
|
||||
"target": {
|
||||
"entity_id": switchHoliday
|
||||
},
|
||||
@ -208,8 +201,7 @@ let sendHoliday = {
|
||||
|
||||
let sendTimer = {
|
||||
"payload": {
|
||||
"domain": "timer",
|
||||
"service": "start",
|
||||
"action": "timer.start",
|
||||
"target": {
|
||||
"entity_id": timerEntity
|
||||
},
|
||||
@ -221,8 +213,7 @@ let sendTimer = {
|
||||
|
||||
let sendTimerCancel = {
|
||||
"payload": {
|
||||
"domain": "timer",
|
||||
"service": "cancel",
|
||||
"action": "timer.cancel",
|
||||
"target": {
|
||||
"entity_id": timerEntity
|
||||
},
|
||||
@ -232,8 +223,7 @@ let sendTimerCancel = {
|
||||
|
||||
let sendNotifyPhone = {
|
||||
"payload": {
|
||||
"domain": "script",
|
||||
"service": "text_notify",
|
||||
"action": "script.text_notify",
|
||||
"data": {
|
||||
"who": "all",
|
||||
"title": notifyTitle,
|
||||
@ -246,8 +236,7 @@ let sendNotifyPhone = {
|
||||
|
||||
let sendNotifyTV = {
|
||||
"payload": {
|
||||
"domain": "script",
|
||||
"service": "tv_notify",
|
||||
"action": "script.tv_notify",
|
||||
"data": {
|
||||
"who": "all",
|
||||
"title": notifyTitle,
|
||||
@ -263,8 +252,7 @@ let sendNotifyTV = {
|
||||
|
||||
let sendFirstFloorScene = {
|
||||
"payload": {
|
||||
"domain": "script",
|
||||
"service": "evening_on_first_floor",
|
||||
"action": "script.evening_on_first_floor",
|
||||
"data": {
|
||||
"sunset_lights": 1
|
||||
}
|
||||
@ -273,8 +261,7 @@ let sendFirstFloorScene = {
|
||||
|
||||
let sendSecondFloorScene = {
|
||||
"payload": {
|
||||
"domain": "script",
|
||||
"service": "evening_on_second_floor",
|
||||
"action": "script.evening_on_second_floor",
|
||||
"data": {
|
||||
"sunset_lights": 1
|
||||
}
|
||||
@ -283,8 +270,7 @@ let sendSecondFloorScene = {
|
||||
|
||||
let sendDeskScene = {
|
||||
"payload": {
|
||||
"domain": "input_select",
|
||||
"service": "select_option",
|
||||
"action": "input_select.select_option",
|
||||
"target": {
|
||||
"entity_id": ["input_select.tina_desk_scenes"]
|
||||
},
|
||||
|
@ -1,10 +1,13 @@
|
||||
const severeWarningEvents = ["Severe Thunderstorm Warning","Destructive Severe Thunderstorm Warning","Considerable Destructive Severe Thunderstorm Warning"]
|
||||
const tornadoWarningEvents = ["Tornado Warning","Radar Indicated Tornado Warning","Confirmed Tornado Warning","Tornado Emergency"]
|
||||
|
||||
let alerts = msg.payload
|
||||
|
||||
// Filter for Severe Thunderstorm Warnings
|
||||
|
||||
let ts = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Severe Thunderstorm Warning") {
|
||||
severeWarningEvents.includes(alert.raw.properties.event)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
@ -14,7 +17,7 @@ let ts = alerts.filter(function(alert) {
|
||||
|
||||
let tstp = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Severe Thunderstorm Warning" &&
|
||||
severeWarningEvents.includes(alert.raw.properties.event) &&
|
||||
alert.raw.properties.parameters &&
|
||||
alert.raw.properties.parameters.tornadoDetection &&
|
||||
alert.raw.properties.parameters.tornadoDetection.length > 0) {
|
||||
@ -23,24 +26,49 @@ let tstp = alerts.filter(function(alert) {
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for considerable destructive severe thunderstorm warnings
|
||||
|
||||
let cdst = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Considerable Destructive Severe Thunderstorm Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for Tornado Warnings
|
||||
|
||||
let tornado = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Tornado Warning") {
|
||||
tornadoWarningEvents.includes(alert.raw.properties.event)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
let confirmed_tornado = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Confirmed Tornado Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// If there are any alerts, return them
|
||||
|
||||
msg.ts = ts
|
||||
msg.ts_count = ts.length
|
||||
let tstormMsg = {
|
||||
"payload": {
|
||||
"alerts": ts,
|
||||
"count": ts.length,
|
||||
"tornado_possible": tstp.length,
|
||||
"considerable_destructive": cdst.length
|
||||
}
|
||||
}
|
||||
|
||||
msg.tstp = tstp
|
||||
msg.tstp_count = tstp.length
|
||||
let tornadoWarnMsg = {
|
||||
"payload": {
|
||||
"alerts": tornado,
|
||||
"count": tornado.length,
|
||||
"confirmed": confirmed_tornado.length
|
||||
}
|
||||
}
|
||||
|
||||
msg.tornado = tornado
|
||||
msg.tornado_count = tornado.length
|
||||
|
||||
return msg
|
||||
node.send([tstormMsg,tornadoWarnMsg])
|
||||
node.status({fill:'green',shape:'dot',text:'Alerts Updated'})
|
@ -1,46 +0,0 @@
|
||||
let alerts = msg.payload.features
|
||||
|
||||
// Filter for Severe Thunderstorm Warnings
|
||||
|
||||
let ts = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Severe Thunderstorm Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for Severe Thunderstorm Warnings with tornado detection
|
||||
// that have a tornado possible parameter
|
||||
|
||||
let tstp = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Severe Thunderstorm Warning" &&
|
||||
alert.properties.parameters &&
|
||||
alert.properties.parameters.tornadoDetection &&
|
||||
alert.properties.parameters.tornadoDetection.length > 0) {
|
||||
let tornadoPossible = alert.properties.parameters.tornadoDetection[0]
|
||||
return tornadoPossible === "POSSIBLE"
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for Tornado Warnings
|
||||
|
||||
let tornado = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Tornado Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// If there are any alerts, return them
|
||||
|
||||
msg.ts = ts
|
||||
msg.ts_count = ts.length
|
||||
|
||||
msg.tstp = tstp
|
||||
msg.tstp_count = tstp.length
|
||||
|
||||
msg.tornado = tornado
|
||||
msg.tornado_count = tornado.length
|
||||
|
||||
return msg
|
148
weather/local_alerts.js
Normal file
148
weather/local_alerts.js
Normal file
@ -0,0 +1,148 @@
|
||||
const severeWarningEvents = ["Severe Thunderstorm Warning","Destructive Severe Thunderstorm Warning","Considerable Destructive Severe Thunderstorm Warning"]
|
||||
const tornadoWarningEvents = ["Tornado Warning","Radar Indicated Tornado Warning","Confirmed Tornado Warning","Tornado Emergency"]
|
||||
const tornadoWatchEvents = ["Tornado Watch"]
|
||||
const severeThunderstormWatchEvents = ["Severe Thunderstorm Watch"]
|
||||
const area = msg.area
|
||||
const mqttTopic = "weather/alerts/" + area
|
||||
const tstormTopic = mqttTopic + "/severe_thunderstorm_warning"
|
||||
const tornadoWarnTopic = mqttTopic + "/tornado_warning"
|
||||
const tornadoWatchTopic = mqttTopic + "/tornado_watch"
|
||||
const severeThunderstormWatchTopic = mqttTopic + "/severe_thunderstorm_watch"
|
||||
|
||||
let alerts = msg.payload.features
|
||||
let tornado_possible = false
|
||||
let considerable_destructive = false
|
||||
let confirmed = false
|
||||
|
||||
// Filter for Severe Thunderstorm Warnings
|
||||
|
||||
let ts = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
severeWarningEvents.includes(alert.properties.event)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for Severe Thunderstorm Warnings with tornado detection
|
||||
// that have a tornado possible parameter
|
||||
|
||||
let tstp = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
severeWarningEvents.includes(alert.properties.event) &&
|
||||
alert.properties.parameters &&
|
||||
alert.properties.parameters.tornadoDetection &&
|
||||
alert.properties.parameters.tornadoDetection.length > 0) {
|
||||
let tornadoPossible = alert.properties.parameters.tornadoDetection[0]
|
||||
return tornadoPossible === "POSSIBLE"
|
||||
}
|
||||
})
|
||||
|
||||
if (tstp.length > 0) {
|
||||
tornado_possible = true
|
||||
}
|
||||
|
||||
// Filter for considerable destructive severe thunderstorm warnings
|
||||
|
||||
let cdst = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Considerable Destructive Severe Thunderstorm Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
if (cdst.length > 0) {
|
||||
considerable_destructive = true
|
||||
}
|
||||
|
||||
// Filter for Tornado Warnings
|
||||
|
||||
let tornado = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
tornadoWarningEvents.includes(alert.properties.event)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
let confirmed_tornado = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Confirmed Tornado Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
if (confirmed_tornado.length > 0) {
|
||||
confirmed = true
|
||||
}
|
||||
|
||||
// Filter for Tornado Watches
|
||||
|
||||
let tornado_watch = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
tornadoWatchEvents.includes(alert.properties.event)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for Severe Thunderstorm Watches
|
||||
|
||||
let severe_thunderstorm_watch = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
severeThunderstormWatchEvents.includes(alert.properties.event)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// If there are any alerts, return them
|
||||
|
||||
let allAlerts = {
|
||||
"payload": msg.payload.features
|
||||
}
|
||||
|
||||
let tstormMsg = {
|
||||
"payload": {
|
||||
"alerts": ts,
|
||||
"count": ts.length,
|
||||
"tornado_possible": tornado_possible,
|
||||
"considerable_destructive": considerable_destructive
|
||||
},
|
||||
"topic": tstormTopic
|
||||
}
|
||||
|
||||
let tornadoWarnMsg = {
|
||||
"payload": {
|
||||
"alerts": tornado,
|
||||
"count": tornado.length,
|
||||
"confirmed": confirmed
|
||||
},
|
||||
"topic": tornadoWarnTopic
|
||||
}
|
||||
|
||||
let tornadoWatchMsg = {
|
||||
"payload": {
|
||||
"alerts": tornado_watch,
|
||||
"count": tornado_watch.length
|
||||
},
|
||||
"topic": tornadoWatchTopic
|
||||
}
|
||||
|
||||
let severeThunderstormWatchMsg = {
|
||||
"payload": {
|
||||
"alerts": severe_thunderstorm_watch,
|
||||
"count": severe_thunderstorm_watch.length
|
||||
},
|
||||
"topic": severeThunderstormWatchTopic
|
||||
}
|
||||
|
||||
// Create status message for node
|
||||
|
||||
let statusMsg = {
|
||||
"status": {
|
||||
"fill": "green",
|
||||
"shape": "dot",
|
||||
"text": alerts.length + " alerts processed at " + new Date().toLocaleString()
|
||||
}
|
||||
}
|
||||
|
||||
// Send messages to output nodes
|
||||
|
||||
node.send([allAlerts,tstormMsg,tornadoWarnMsg,tornadoWatchMsg,severeThunderstormWatchMsg,statusMsg])
|
Reference in New Issue
Block a user