mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-11 00:57:31 -05:00
Fix alerts not being checked properly
This commit is contained in:
parent
ffb98eef8f
commit
d7da02deba
@ -38,7 +38,7 @@ async def getAlerts(location):
|
||||
|
||||
async with aiohttp.ClientSession() as s:
|
||||
async with s.get(fetchUrl) as r:
|
||||
theCode = await r.status
|
||||
theCode = r.status
|
||||
|
||||
#Set the actions based on response code
|
||||
if theCode == 204:
|
||||
@ -327,9 +327,7 @@ async def makeRecord():
|
||||
loop = asyncio.get_running_loop()
|
||||
global k
|
||||
|
||||
# The BERecord XML doesn't need to be written if there's no alerts.
|
||||
if k > 0:
|
||||
async with aiofiles.open("./.temp/BERecord.xml", 'a') as BERecord:
|
||||
async with aiofiles.open("./.temp/BERecord.xml", 'w') as BERecord:
|
||||
await BERecord.write('<Data type="BERecord">')
|
||||
await BERecord.close()
|
||||
|
||||
@ -347,6 +345,8 @@ async def makeRecord():
|
||||
await h.write(pretty_xml_as_string[23:])
|
||||
await h.close()
|
||||
|
||||
# The BERecord XML doesn't need to be written if there's no alerts.
|
||||
if k > 0:
|
||||
l.info("Sending alert(s) to the IntelliStar 2!")
|
||||
with open("./.temp/BERecord.i2m", 'rb') as f_in:
|
||||
with gzip.open("./.temp/BERecord.gz", 'wb') as f_out:
|
||||
|
Loading…
x
Reference in New Issue
Block a user