I trigger on the "Alert Status" state "Becomes Equal To" "True". Then I use the following script in the Action to email the alert to me:
- Code: Select all
wsStates = indigo.devices[665073353].states
def sendAlertEmail(alert, message, expires):
theSubject = "Weather Alert: %s" % alert
theBody = "%s\n\nThis weather alert is valid until %s" % (message, expires)
bePlugin = indigo.server.getPlugin("com.flyingdiver.indigoplugin.betteremail")
if bePlugin.isEnabled():
bePlugin.executeAction("sendEmail", deviceId=1422637605,
props={'emailTo':'<email address here>', 'emailSubject': theSubject, 'emailMessage': theBody})
return
if wsStates[u'alertDescription1'] != ' ':
sendAlertEmail(wsStates[u'alertDescription1'], wsStates[u'alertMessage1'], wsStates[u'alertExpires1'])
if wsStates[u'alertDescription2'] != ' ':
sendAlertEmail(wsStates[u'alertDescription2'], wsStates[u'alertMessage2'], wsStates[u'alertExpires2'])
if wsStates[u'alertDescription3'] != ' ':
sendAlertEmail(wsStates[u'alertDescription3'], wsStates[u'alertMessage3'], wsStates[u'alertExpires3'])
if wsStates[u'alertDescription4'] != ' ':
sendAlertEmail(wsStates[u'alertDescription4'], wsStates[u'alertMessage4'], wsStates[u'alertExpires4'])
That uses my BetterEmail plugin to send the email. I think you can do something similar with the built in Email sender if you want to.
You'll get an email with something like this in the body:
...Strong thunderstorms will affect south central Charlotte and
central Lee counties...
At 622 PM EDT...a strong thunderstorm was located near Bonita
Springs...moving northwest at 15 mph. Additional strong
thunderstorms will develop over central Lee and south central
Charlotte counties through 730 PM.
Winds of 40 to 50 mph and half inch hail are possible with these
storms.
Locations impacted include...
Cape Coral...Fort Myers...Bonita Springs...Punta Gorda...Cypress Lake...
Pine Manor...Buckingham...Three Oaks...east Dunbar...southwest Florida
Airport...San Carlos Park...palmona park...lochmoor Waterway Estates...
Villas...McGregor...Harlem Heights...Iona...North Naples...burnt store
Marina and Fort Myers Villas.
Torrential rainfall is also occurring with this storm...and may cause
localized flooding. Do not drive your vehicle through flooded
roadways.
Frequent cloud to ground lightning is occurring with this storm.
Lightning can strike 10 miles away from a thunderstorm. Seek a safe
shelter inside a building or vehicle.
Lat...Lon 2678 8216 2697 8189 2642 8161 2642 8166
2633 8166 2632 8167 2631 8177
time...Mot...loc 2222z 147deg 22kt 2640 8171