Alerts without FWP

Posted on
Tue Dec 20, 2022 10:11 am
roquej offline
User avatar
Posts: 609
Joined: Jan 04, 2015
Location: South Florida, USA

Alerts without FWP

The only thing left to replace is weather alerts.

Do you have any suggestions on how to accomplish the same alert functionality with GhostXML or the NOAA plugin? I believe the below was your code:

wsStates = indigo.devices[DEVICEID].states #FWD device
smtpDevice = DEVICEID

def sendAlertEmail(alert, message, expires):
emailTo = "email@email.com"
theSubject = "Weather Alert: %s" % str(alert)
theBody = "%s\n\nThis weather alert is valid until %s" % (message,expires)
props={
'emailTo': emailTo,
'emailCC': '',
'emailBCC': '',
'emailSubject': theSubject,
'emailAttachments':'',
'emailFormat': 'plain',
'emailMessage': theBody
}

plugin = indigo.server.getPlugin("com.indigodomo.email")
if plugin.isEnabled():
plugin.executeAction("sendEmail", deviceId=smtpDevice, props=props)
return

if str(wsStates[u'alertTitle1']) != ' ':
sendAlertEmail(wsStates[u'alertTitle1'], wsStates[u'alertDescription1'], wsStates[u'alertExpires1'])

if wsStates[u'alertTitle2'] != ' ':
sendAlertEmail(wsStates[u'alertTitle2'], wsStates[u'alertDescription2'], wsStates[u'alertExpires2'])

if wsStates[u'alertTitle3'] != ' ':
sendAlertEmail(wsStates[u'alertTitle3'], wsStates[u'alertDescription3'], wsStates[u'alertExpires3'])

if wsStates[u'alertTitle4'] != ' ':
sendAlertEmail(wsStates[u'alertTitle4'], wsStates[u'alertDescription4'], wsStates[u'alertExpires4'])

if wsStates[u'alertTitle5'] != ' ':

sendAlertEmail(wsStates[u'alertTitle5'], wsStates[u'alertDescription5'], wsStates[u'alertExpires5'])

Posted on
Tue Dec 20, 2022 2:28 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Alerts without FWP

That doesn't look like my work, but anything is possible.

With the NOAA plugin that shipped with Indigo 2022.1, the plugin includes a Weather Alert device type that you can use with Indigo Triggers. The state names that show up in the Create Trigger dialog box need to be improved (my fault NOT Jay's or Matt's). These labels will be improved in a future release.

You can select the first "Sent" state in the list and that should correspond to Alert 1. Or you could watch the "Alert Count" value. If you select "Observation Date/Time", it will trigger any time the data are updated (which may or may not mean a new severe weather alert).

With GhostXML, the method would be largely the same. Create Triggers that fire when your chosen weather alert data changes.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests