major rewrite
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -13,4 +13,5 @@ __pycache__/
|
|||||||
# Temp directory
|
# Temp directory
|
||||||
.temp/
|
.temp/
|
||||||
|
|
||||||
conf.json
|
conf.json
|
||||||
|
config.json
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
3) Use command prompt to enter the directory of the scripts, then install package requirements:<br/>
|
3) Use command prompt to enter the directory of the scripts, then install package requirements:<br/>
|
||||||
```pip install -r requirements.txt``` <br/>
|
```pip install -r requirements.txt``` <br/>
|
||||||
4) Copy **config.example.json** to **config.json** and edit to your specific config.
|
4) Copy **config.example.json** to **config.json** and edit to your specific config.
|
||||||
4) Drop your unit's **MachineProductConfiguration.xml** file into the root of the script
|
4) Drop your unit's **MachineProductCfg.xml** file into the root of the script
|
||||||
5) Run ``py main.py``
|
5) Run ``py main.py``
|
||||||
|
|
||||||
### Attributions & Disclaimers
|
### Attributions & Disclaimers
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from recordGenerators import Alerts,CurrentObservations,HourlyForecast,DailyForecast, AirQuality, AirportDelays, AchesAndPains, Breathing, HeatingAndCooling, MosquitoActivity, PollenForecast, TideForecast, WateringNeeds
|
from recordGenerators import alerts,currentObservations,hourlyForecast,dailyForecast, airQuality, airportDelays, achesAndPains, breathing, heatingAndCooling, mosquitoActivity, pollenForecast, tideForecast, wateringNeeds
|
||||||
from radar import TWCRadarCollector
|
from radar import TWCRadarCollector
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@@ -25,67 +25,67 @@ async def updateSatradTask():
|
|||||||
|
|
||||||
async def alertsTask():
|
async def alertsTask():
|
||||||
while True:
|
while True:
|
||||||
await Alerts.makeRecord()
|
await alerts.makeRecord()
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(60)
|
||||||
|
|
||||||
async def coTask():
|
async def coTask():
|
||||||
while True:
|
while True:
|
||||||
await CurrentObservations.makeDataFile()
|
await currentObservations.makeDataFile()
|
||||||
await asyncio.sleep(5 * 60)
|
await asyncio.sleep(5 * 60)
|
||||||
|
|
||||||
# These tasks should be updated every hour
|
# These tasks should be updated every hour
|
||||||
|
|
||||||
async def hfTask():
|
async def hfTask():
|
||||||
while True:
|
while True:
|
||||||
await HourlyForecast.makeDataFile()
|
await hourlyForecast.makeDataFile()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def dfTask():
|
async def dfTask():
|
||||||
while True:
|
while True:
|
||||||
await DailyForecast.makeDataFile()
|
await dailyForecast.makeDataFile()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def aqTask():
|
async def aqTask():
|
||||||
while True:
|
while True:
|
||||||
await AirQuality.writeData()
|
await airQuality.writeData()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def aptTask():
|
async def aptTask():
|
||||||
while True:
|
while True:
|
||||||
await AirportDelays.writeData()
|
await airportDelays.writeData()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def apTask():
|
async def apTask():
|
||||||
while True:
|
while True:
|
||||||
await AchesAndPains.makeRecord()
|
await achesAndPains.makeRecord()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def brTask():
|
async def brTask():
|
||||||
while True:
|
while True:
|
||||||
await Breathing.makeDataFile()
|
await breathing.makeDataFile()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def hcTask():
|
async def hcTask():
|
||||||
while True:
|
while True:
|
||||||
await HeatingAndCooling.makeRecord()
|
await heatingAndCooling.makeRecord()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def maTask():
|
async def maTask():
|
||||||
while True:
|
while True:
|
||||||
await MosquitoActivity.makeRecord()
|
await mosquitoActivity.makeRecord()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def pTask():
|
async def pTask():
|
||||||
while True:
|
while True:
|
||||||
await PollenForecast.makeDataFile()
|
await pollenForecast.makeDataFile()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def tTask():
|
async def tTask():
|
||||||
while True:
|
while True:
|
||||||
await TideForecast.makeRecord()
|
await tideForecast.makeRecord()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def wnTask():
|
async def wnTask():
|
||||||
while True:
|
while True:
|
||||||
await WateringNeeds.makeRecord()
|
await wateringNeeds.makeRecord()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|||||||
44
main.py
44
main.py
@@ -5,11 +5,11 @@ import logging,coloredlogs
|
|||||||
from radar import TWCRadarCollector
|
from radar import TWCRadarCollector
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import RecordTasks
|
import recordTasks
|
||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
@@ -19,7 +19,7 @@ useRadarServer = cfg["useRadarServer"]
|
|||||||
|
|
||||||
async def createTemp():
|
async def createTemp():
|
||||||
""" Used on a first time run, creates necessary files & directories for the message encoder to work properly. """
|
""" Used on a first time run, creates necessary files & directories for the message encoder to work properly. """
|
||||||
if not (os.path.exists('./.temp/')):
|
if not (os.path.exists('./.temp')):
|
||||||
l.info("Creating necessary directories & files..")
|
l.info("Creating necessary directories & files..")
|
||||||
os.mkdir('./.temp')
|
os.mkdir('./.temp')
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@ async def createTemp():
|
|||||||
os.mkdir('./.temp/output/satrad')
|
os.mkdir('./.temp/output/satrad')
|
||||||
|
|
||||||
# Create msgId file for bit.py
|
# Create msgId file for bit.py
|
||||||
async with aiofiles.open('./.temp/msgId.txt', 'w') as msgId:
|
#async with aiofiles.open('./.temp/msgId.txt', 'w') as msgId:
|
||||||
await msgId.write('410080515')
|
#await msgId.write('694203')
|
||||||
await msgId.close()
|
#await msgId.close()
|
||||||
else:
|
else:
|
||||||
l.debug(".temp file exists")
|
l.debug(".temp file exists")
|
||||||
return
|
return
|
||||||
@@ -44,21 +44,21 @@ async def createTemp():
|
|||||||
async def main():
|
async def main():
|
||||||
await createTemp()
|
await createTemp()
|
||||||
|
|
||||||
mosaicTask = asyncio.create_task(RecordTasks.updateMosaicTask())
|
mosaicTask = asyncio.create_task(recordTasks.updateMosaicTask())
|
||||||
satradTask = asyncio.create_task(RecordTasks.updateSatradTask())
|
satradTask = asyncio.create_task(recordTasks.updateSatradTask())
|
||||||
alertsTask = asyncio.create_task(RecordTasks.alertsTask())
|
alertsTask = asyncio.create_task(recordTasks.alertsTask())
|
||||||
coTask = asyncio.create_task(RecordTasks.coTask())
|
coTask = asyncio.create_task(recordTasks.coTask())
|
||||||
hfTask = asyncio.create_task(RecordTasks.hfTask())
|
hfTask = asyncio.create_task(recordTasks.hfTask())
|
||||||
dfTask = asyncio.create_task(RecordTasks.dfTask())
|
dfTask = asyncio.create_task(recordTasks.dfTask())
|
||||||
aqTask = asyncio.create_task(RecordTasks.aqTask())
|
aqTask = asyncio.create_task(recordTasks.aqTask())
|
||||||
aptTask = asyncio.create_task(RecordTasks.aptTask())
|
aptTask = asyncio.create_task(recordTasks.aptTask())
|
||||||
apTask = asyncio.create_task(RecordTasks.apTask())
|
apTask = asyncio.create_task(recordTasks.apTask())
|
||||||
brTask = asyncio.create_task(RecordTasks.brTask())
|
brTask = asyncio.create_task(recordTasks.brTask())
|
||||||
hcTask = asyncio.create_task(RecordTasks.hcTask())
|
hcTask = asyncio.create_task(recordTasks.hcTask())
|
||||||
maTask = asyncio.create_task(RecordTasks.maTask())
|
maTask = asyncio.create_task(recordTasks.maTask())
|
||||||
pTask = asyncio.create_task(RecordTasks.pTask())
|
pTask = asyncio.create_task(recordTasks.pTask())
|
||||||
tTask = asyncio.create_task(RecordTasks.tTask())
|
tTask = asyncio.create_task(recordTasks.tTask())
|
||||||
wnTask = asyncio.create_task(RecordTasks.wnTask())
|
wnTask = asyncio.create_task(recordTasks.wnTask())
|
||||||
|
|
||||||
# In theory, these should all run concurrently without problems
|
# In theory, these should all run concurrently without problems
|
||||||
await alertsTask
|
await alertsTask
|
||||||
@@ -80,4 +80,4 @@ async def main():
|
|||||||
await satradTask
|
await satradTask
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|||||||
216
py2Lib/bit.old
Normal file
216
py2Lib/bit.old
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
import socket
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import struct
|
||||||
|
import binascii
|
||||||
|
import math
|
||||||
|
import time
|
||||||
|
import logging,coloredlogs
|
||||||
|
|
||||||
|
# Open the config file and make it accessible via "cfg"
|
||||||
|
import json
|
||||||
|
with open("conf.json", "r") as file:
|
||||||
|
cfg = json.load(file)
|
||||||
|
|
||||||
|
l = logging.getLogger(__name__)
|
||||||
|
coloredlogs.install()
|
||||||
|
|
||||||
|
MCAST_GRP = cfg["multicastGroup"]
|
||||||
|
MCAST_IF = cfg["multicastIf"]
|
||||||
|
BUF_SIZE = 1396
|
||||||
|
|
||||||
|
MULTICAST_TTL = 2
|
||||||
|
|
||||||
|
conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
|
||||||
|
conn.setsockopt(socket.IPPROTO_IP,socket.IP_ADD_MEMBERSHIP,socket.inet_aton(MCAST_GRP)+socket.inet_aton(MCAST_IF))
|
||||||
|
|
||||||
|
test = b"This is a test"
|
||||||
|
|
||||||
|
def sendFile(files, commands, numSgmts, Pri):
|
||||||
|
if Pri == 0:
|
||||||
|
MCAST_PORT = 7787
|
||||||
|
elif Pri == 1:
|
||||||
|
MCAST_PORT = 7788
|
||||||
|
else:
|
||||||
|
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
||||||
|
exit()
|
||||||
|
#Get the next message ID
|
||||||
|
with open('./.temp/msgId.txt', "r") as f:
|
||||||
|
oMsgId = f.read()
|
||||||
|
msgNum = int(oMsgId)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
nMsgNum = msgNum + 1
|
||||||
|
h = open('./.temp/msgId.txt', "w")
|
||||||
|
h.write(str(nMsgNum))
|
||||||
|
h.close()
|
||||||
|
segnmNum = 0
|
||||||
|
if Pri == 0:
|
||||||
|
l.info("Sending Routine Msg-" + str(msgNum) + " on UDP " + MCAST_GRP + " " + str(MCAST_PORT) + "....")
|
||||||
|
elif Pri == 1:
|
||||||
|
l.info("Sending High Priority Msg-" + str(msgNum) + " on UDP " + MCAST_GRP + " " + str(MCAST_PORT) + "....")
|
||||||
|
startFlag = False
|
||||||
|
|
||||||
|
for x, y in zip(files, commands):
|
||||||
|
size = os.path.getsize(x)
|
||||||
|
check = size - BUF_SIZE
|
||||||
|
pToBeSent = size / 1405
|
||||||
|
packRounded = math.ceil(pToBeSent) + 1
|
||||||
|
numSegments = numSgmts + 3
|
||||||
|
total_sent = 0
|
||||||
|
payloadLength = 0
|
||||||
|
packet_count = 1
|
||||||
|
j = 0
|
||||||
|
pc = packet_count.to_bytes(1, byteorder='big')
|
||||||
|
i = 0
|
||||||
|
encode1 = bytes(y + 'I2MSG', 'UTF-8')
|
||||||
|
commandLength = len(y)
|
||||||
|
encode2 = commandLength.to_bytes(4, byteorder='little')
|
||||||
|
theCommand = b"".join([encode1, encode2])
|
||||||
|
char = ''
|
||||||
|
new_file = open(x, "ab")
|
||||||
|
new_file.write(theCommand) # Append command to end of the file
|
||||||
|
new_file.close()
|
||||||
|
new_size = os.path.getsize(x)
|
||||||
|
|
||||||
|
if startFlag == False:
|
||||||
|
#Our 34 byte beginning packet
|
||||||
|
p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0)
|
||||||
|
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
|
||||||
|
startFlag = True
|
||||||
|
with open(x,"rb") as message:
|
||||||
|
message.seek(0)
|
||||||
|
data = message.read(BUF_SIZE)
|
||||||
|
while data:
|
||||||
|
packetHeader = struct.pack(">BHHHIIBBB", 18, 1, 0, 1405, msgNum, packet_count, 0, 0, 0)
|
||||||
|
fec = struct.pack("<IBI", packet_count, 0, new_size)
|
||||||
|
if len(data) < BUF_SIZE:
|
||||||
|
nullCharacterLen = BUF_SIZE - len(data)
|
||||||
|
char = ''
|
||||||
|
while(i < nullCharacterLen):
|
||||||
|
char += '00'
|
||||||
|
i = i+1
|
||||||
|
theNull = bytes.fromhex(char)
|
||||||
|
conn.sendto(packetHeader + fec + data + theNull, (MCAST_GRP, MCAST_PORT))
|
||||||
|
else:
|
||||||
|
conn.sendto(packetHeader + fec + data, (MCAST_GRP, MCAST_PORT))
|
||||||
|
l.debug(packet_count)
|
||||||
|
packet_count += 1
|
||||||
|
j += 1
|
||||||
|
|
||||||
|
#Rate Limit UDP Packets To Prevent Packet Overflow On Transport Stream.
|
||||||
|
if j == 1000: #Number of packets to be sent before pausing
|
||||||
|
time.sleep(2) #Pause for this number of seconds
|
||||||
|
j = 0
|
||||||
|
data = message.read(BUF_SIZE)
|
||||||
|
else:
|
||||||
|
data = message.read(BUF_SIZE)
|
||||||
|
segnmNum += 1
|
||||||
|
|
||||||
|
# OUR TEST MESSAGE BLOCK
|
||||||
|
#-------------------------------------------------------------------------------------------------------
|
||||||
|
w = 3
|
||||||
|
while w <= 3 and w != 0:
|
||||||
|
p3 = struct.pack(">BHHHIIBBBBBBBI", 18, 1, 1, 8, msgNum, 0, segnmNum, 0, 0, 8, 0, 0, 0, 67108864)
|
||||||
|
p4 = struct.pack(">BHHHIIBBB", 18, 1, 1, 14, msgNum, 1, segnmNum, 0, 0) + test
|
||||||
|
conn.sendto(p3, (MCAST_GRP, MCAST_PORT))
|
||||||
|
conn.sendto(p4, (MCAST_GRP, MCAST_PORT))
|
||||||
|
segnmNum += 1
|
||||||
|
w -= 1
|
||||||
|
#-------------------------------------------------------------------------------------------------------
|
||||||
|
def sendCommand(command, Pri, msgNum = None):
|
||||||
|
if Pri == 0:
|
||||||
|
MCAST_PORT = 7787
|
||||||
|
elif Pri == 1:
|
||||||
|
MCAST_PORT = 7788
|
||||||
|
else:
|
||||||
|
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
||||||
|
exit()
|
||||||
|
#Get the next message ID
|
||||||
|
with open('./.temp/msgId.txt', "r") as f:
|
||||||
|
oMsgId = f.read()
|
||||||
|
msgNum = int(oMsgId)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
nMsgNum = msgNum + 1
|
||||||
|
h = open('./.temp/msgId.txt', "w")
|
||||||
|
h.write(str(nMsgNum))
|
||||||
|
h.close()
|
||||||
|
segnmNum = 0
|
||||||
|
if Pri == 0:
|
||||||
|
l.info("Sending Routine Msg-" + str(msgNum) + " on UDP " + MCAST_GRP + " " + str(MCAST_PORT) + "....")
|
||||||
|
elif Pri == 1:
|
||||||
|
l.info("Sending High Priority Msg-" + str(msgNum) + " on UDP " + MCAST_GRP + " " + str(MCAST_PORT) + "....")
|
||||||
|
startFlag = False
|
||||||
|
|
||||||
|
for x in command:
|
||||||
|
bx = bytes(x, 'utf-8')
|
||||||
|
with open('./.temp/command', 'wb') as c:
|
||||||
|
c.write(bx)
|
||||||
|
c.close()
|
||||||
|
size = os.path.getsize('./.temp/command')
|
||||||
|
encode1 = bytes('I2MSG', 'UTF-8')
|
||||||
|
commandLength = size
|
||||||
|
encode2 = commandLength.to_bytes(4, byteorder='little')
|
||||||
|
theCommand = b"".join([encode1, encode2])
|
||||||
|
with open('./.temp/command', 'ab') as d:
|
||||||
|
d.write(theCommand)
|
||||||
|
d.close()
|
||||||
|
check = size - BUF_SIZE
|
||||||
|
pToBeSent = size / 1405
|
||||||
|
packRounded = math.ceil(pToBeSent) + 1
|
||||||
|
numSegments = 4
|
||||||
|
total_sent = 0
|
||||||
|
payloadLength = 0
|
||||||
|
packet_count = 1
|
||||||
|
j = 0
|
||||||
|
pc = packet_count.to_bytes(4, byteorder='little')
|
||||||
|
i = 0
|
||||||
|
char = ''
|
||||||
|
new_size = os.path.getsize('./.temp/command')
|
||||||
|
|
||||||
|
if startFlag == False:
|
||||||
|
#Our 34 byte beginning packet
|
||||||
|
p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0)
|
||||||
|
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
|
||||||
|
startFlag = True
|
||||||
|
with open('./.temp/Command',"rb") as message:
|
||||||
|
message.seek(0)
|
||||||
|
data = message.read(BUF_SIZE)
|
||||||
|
while data:
|
||||||
|
packetHeader = struct.pack(">BHHHIIBBB", 18, 1, 0, 1405, msgNum, packet_count, 0, 0, 0)
|
||||||
|
fec = struct.pack("<IBI", packet_count, 0, new_size)
|
||||||
|
if len(data) < BUF_SIZE:
|
||||||
|
nullCharacterLen = BUF_SIZE - len(data)
|
||||||
|
char = ''
|
||||||
|
while(i < nullCharacterLen):
|
||||||
|
char += '00'
|
||||||
|
i = i+1
|
||||||
|
theNull = bytes.fromhex(char)
|
||||||
|
conn.sendto(packetHeader + fec + data + theNull, (MCAST_GRP, MCAST_PORT))
|
||||||
|
else:
|
||||||
|
conn.sendto(packetHeader + fec + data, (MCAST_GRP, MCAST_PORT))
|
||||||
|
l.debug(packet_count)
|
||||||
|
packet_count += 1
|
||||||
|
j += 1
|
||||||
|
|
||||||
|
#Rate limit UDP Packets to prevent Packet Overflow on i2 machine.
|
||||||
|
if j == 1000: #Number of packets to be sent before pausing
|
||||||
|
time.sleep(10) #Pause for this number of seconds
|
||||||
|
j = 0
|
||||||
|
data = message.read(BUF_SIZE)
|
||||||
|
else:
|
||||||
|
data = message.read(BUF_SIZE)
|
||||||
|
segnmNum += 1
|
||||||
|
|
||||||
|
# OUR TEST MESSAGE BLOCK
|
||||||
|
#-------------------------------------------------------------------------------------------------------
|
||||||
|
w = 3
|
||||||
|
while w <= 3 and w != 0:
|
||||||
|
p3 = struct.pack(">BHHHIIBBBBBBBI", 18, 1, 1, 8, msgNum, 0, segnmNum, 0, 0, 8, 0, 0, 0, 67108864)
|
||||||
|
p4 = struct.pack(">BHHHIIBBB", 18, 1, 1, 14, msgNum, 1, segnmNum, 0, 0) + test
|
||||||
|
conn.sendto(p3, (MCAST_GRP, MCAST_PORT))
|
||||||
|
conn.sendto(p4, (MCAST_GRP, MCAST_PORT))
|
||||||
|
segnmNum += 1
|
||||||
|
w -= 1
|
||||||
|
#-------------------------------------------------------------------------------------------------------
|
||||||
@@ -6,10 +6,11 @@ import binascii
|
|||||||
import math
|
import math
|
||||||
import time
|
import time
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
@@ -34,14 +35,22 @@ def sendFile(files, commands, numSgmts, Pri):
|
|||||||
else:
|
else:
|
||||||
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
||||||
exit()
|
exit()
|
||||||
#Get the next message ID
|
|
||||||
with open('./.temp/msgId.txt', "r") as f:
|
# Create msgId if it doesn't exist
|
||||||
|
msg_id_file = Path('./.temp/msgId.txt')
|
||||||
|
if not os.path.exists(msg_id_file):
|
||||||
|
msg_id_file_p = Path('./.temp/msgId.txt')
|
||||||
|
msg_id_file_p.parent.mkdir(exist_ok=True, parents=True)
|
||||||
|
msg_id_file_p.write_text("1")
|
||||||
|
|
||||||
|
# Get the next message ID
|
||||||
|
with open(msg_id_file, "r") as f:
|
||||||
oMsgId = f.read()
|
oMsgId = f.read()
|
||||||
msgNum = int(oMsgId)
|
msgNum = int(oMsgId)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
nMsgNum = msgNum + 1
|
nMsgNum = msgNum + 1
|
||||||
h = open('./.temp/msgId.txt', "w")
|
h = open(msg_id_file, "w")
|
||||||
h.write(str(nMsgNum))
|
h.write(str(nMsgNum))
|
||||||
h.close()
|
h.close()
|
||||||
segnmNum = 0
|
segnmNum = 0
|
||||||
@@ -126,14 +135,22 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
else:
|
else:
|
||||||
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
||||||
exit()
|
exit()
|
||||||
#Get the next message ID
|
|
||||||
with open('./.temp/msgId.txt', "r") as f:
|
# Create msgId if it doesn't exist
|
||||||
|
msg_id_file = Path('./.temp/msgId.txt')
|
||||||
|
if not os.path.exists(msg_id_file):
|
||||||
|
msg_id_file_p = Path('./.temp/msgId.txt')
|
||||||
|
msg_id_file_p.parent.mkdir(exist_ok=True, parents=True)
|
||||||
|
msg_id_file_p.write_text("1")
|
||||||
|
|
||||||
|
# Get the next message ID
|
||||||
|
with open(msg_id_file, "r") as f:
|
||||||
oMsgId = f.read()
|
oMsgId = f.read()
|
||||||
msgNum = int(oMsgId)
|
msgNum = int(oMsgId)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
nMsgNum = msgNum + 1
|
nMsgNum = msgNum + 1
|
||||||
h = open('./.temp/msgId.txt', "w")
|
h = open(msg_id_file, "w")
|
||||||
h.write(str(nMsgNum))
|
h.write(str(nMsgNum))
|
||||||
h.close()
|
h.close()
|
||||||
segnmNum = 0
|
segnmNum = 0
|
||||||
@@ -174,7 +191,7 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0)
|
p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0)
|
||||||
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
|
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
|
||||||
startFlag = True
|
startFlag = True
|
||||||
with open('./.temp/Command',"rb") as message:
|
with open('./.temp/command',"rb") as message:
|
||||||
message.seek(0)
|
message.seek(0)
|
||||||
data = message.read(BUF_SIZE)
|
data = message.read(BUF_SIZE)
|
||||||
while data:
|
while data:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from os import path, listdir, remove
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
from py2Lib import bit
|
import py2Lib.bit
|
||||||
import Util.MachineProductCfg as MPC
|
import util.machineProductCfg as MPC
|
||||||
import records.LFRecord as LFR
|
import records.lfRecord as LFR
|
||||||
import gzip
|
import gzip
|
||||||
from os import remove
|
from os import remove
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@@ -21,7 +21,7 @@ for i in MPC.getPrimaryLocations():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -82,4 +82,4 @@ async def makeRecord():
|
|||||||
bit.sendFile([file], [command], 1, 0)
|
bit.sendFile([file], [command], 1, 0)
|
||||||
|
|
||||||
remove('./.temp/AchesAndPains.i2m')
|
remove('./.temp/AchesAndPains.i2m')
|
||||||
remove('./.temp/AchesAndPains.gz')
|
remove('./.temp/AchesAndPains.gz')
|
||||||
|
|||||||
@@ -9,13 +9,9 @@ import aiohttp, aiofiles, asyncio
|
|||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
|
|
||||||
import sys
|
import py2Lib.bit
|
||||||
sys.path.append("./py2lib")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./Util")
|
import records.lfRecord as LFR
|
||||||
sys.path.append("./records")
|
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
locationIds = []
|
locationIds = []
|
||||||
zipCodes = []
|
zipCodes = []
|
||||||
@@ -28,7 +24,7 @@ for i in MPC.getPrimaryLocations():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|||||||
@@ -6,13 +6,9 @@ import xml.dom.minidom
|
|||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio
|
import aiohttp, aiofiles, asyncio
|
||||||
|
|
||||||
import sys
|
import py2Lib.bit
|
||||||
sys.path.append("./py2lib")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./Util")
|
import records.lfRecord as LFR
|
||||||
sys.path.append("./records")
|
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
@@ -30,7 +26,7 @@ l.debug(airports)
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import requests
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from datetime import datetime,timedelta
|
from datetime import datetime,timedelta
|
||||||
from Util.MachineProductCfg import getAlertZones
|
from util.machineProductCfg import getAlertZones
|
||||||
import time
|
import time
|
||||||
import pytz
|
import pytz
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@@ -10,11 +10,7 @@ import shutil
|
|||||||
import gzip
|
import gzip
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio
|
import aiohttp, aiofiles, asyncio
|
||||||
|
import py2Lib.bit
|
||||||
|
|
||||||
import sys
|
|
||||||
sys.path.append("./py2lib")
|
|
||||||
import bit
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
@@ -23,7 +19,7 @@ coloredlogs.install()
|
|||||||
alertLocations = getAlertZones()
|
alertLocations = getAlertZones()
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
headlineApiKey = cfg["twcApiKey"]
|
headlineApiKey = cfg["twcApiKey"]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import requests
|
import requests
|
||||||
import sys
|
|
||||||
import gzip
|
import gzip
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
@@ -8,12 +7,9 @@ import xml.dom.minidom
|
|||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio
|
import aiohttp, aiofiles, asyncio
|
||||||
|
|
||||||
sys.path.append("./py2lib")
|
import py2Lib.bit
|
||||||
sys.path.append("./Util")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./records")
|
import records.lfRecord as LFR
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
@@ -31,7 +27,7 @@ l.debug(coopIds, geocodes)
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -94,4 +90,4 @@ async def makeDataFile():
|
|||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("./.temp/Breathing.i2m")
|
os.remove("./.temp/Breathing.i2m")
|
||||||
os.remove("./.temp/Breathing.gz")
|
os.remove("./.temp/Breathing.gz")
|
||||||
|
|||||||
@@ -8,13 +8,9 @@ import xml.dom.minidom
|
|||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio
|
import aiohttp, aiofiles, asyncio
|
||||||
|
|
||||||
import sys
|
import py2Lib.bit
|
||||||
sys.path.append("./py2lib")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./Util")
|
import records.lfRecord as LFR
|
||||||
sys.path.append("./records")
|
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
@@ -35,7 +31,7 @@ for i in MPC.getMetroCities():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import requests
|
import requests
|
||||||
import sys
|
|
||||||
import gzip
|
import gzip
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
@@ -8,12 +7,9 @@ import xml.dom.minidom
|
|||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio
|
import aiohttp, aiofiles, asyncio
|
||||||
|
|
||||||
sys.path.append("./py2lib")
|
import py2Lib.bit
|
||||||
sys.path.append("./Util")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./records")
|
import records.lfRecord as LFR
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
@@ -33,7 +29,7 @@ for i in MPC.getMetroCities():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -95,4 +91,4 @@ async def makeDataFile():
|
|||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("./.temp/DailyForecast.i2m")
|
os.remove("./.temp/DailyForecast.i2m")
|
||||||
os.remove("./.temp/DailyForecast.gz")
|
os.remove("./.temp/DailyForecast.gz")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
from py2Lib import bit
|
import py2Lib.bit
|
||||||
import Util.MachineProductCfg as MPC
|
import util.machineProductCfg as MPC
|
||||||
import records.LFRecord as LFR
|
import records.lfRecord as LFR
|
||||||
import gzip
|
import gzip
|
||||||
from os import remove
|
from os import remove
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@@ -21,7 +21,7 @@ for i in MPC.getPrimaryLocations():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -82,4 +82,4 @@ async def makeRecord():
|
|||||||
bit.sendFile([file], [command], 1, 0)
|
bit.sendFile([file], [command], 1, 0)
|
||||||
|
|
||||||
remove('./.temp/HeatingAndCooling.i2m')
|
remove('./.temp/HeatingAndCooling.i2m')
|
||||||
remove('./.temp/HeatingAndCooling.gz')
|
remove('./.temp/HeatingAndCooling.gz')
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ import xml.dom.minidom
|
|||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio, asyncio
|
import aiohttp, aiofiles, asyncio, asyncio
|
||||||
|
|
||||||
import sys
|
import py2Lib.bit
|
||||||
sys.path.append("./py2lib")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./Util")
|
import records.lfRecord as LFR
|
||||||
sys.path.append("./records")
|
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
@@ -33,7 +29,7 @@ for i in MPC.getMetroCities():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -97,4 +93,4 @@ async def makeDataFile():
|
|||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("./.temp/HourlyForecast.i2m")
|
os.remove("./.temp/HourlyForecast.i2m")
|
||||||
os.remove("./.temp/HourlyForecast.gz")
|
os.remove("./.temp/HourlyForecast.gz")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
from py2Lib import bit
|
import py2Lib.bit
|
||||||
import Util.MachineProductCfg as MPC
|
import util.machineProductCfg as MPC
|
||||||
import records.LFRecord as LFR
|
import records.lfRecord as LFR
|
||||||
import gzip
|
import gzip
|
||||||
from os import remove
|
from os import remove
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@@ -21,7 +21,7 @@ for i in MPC.getPrimaryLocations():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -82,4 +82,4 @@ async def makeRecord():
|
|||||||
bit.sendFile([file], [command], 1, 0)
|
bit.sendFile([file], [command], 1, 0)
|
||||||
|
|
||||||
remove('./.temp/MosquitoActivity.i2m')
|
remove('./.temp/MosquitoActivity.i2m')
|
||||||
remove('./.temp/MosquitoActivity.gz')
|
remove('./.temp/MosquitoActivity.gz')
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import requests
|
import requests
|
||||||
import sys
|
|
||||||
import gzip
|
import gzip
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
@@ -8,12 +7,9 @@ import xml.dom.minidom
|
|||||||
import logging, coloredlogs
|
import logging, coloredlogs
|
||||||
import aiohttp, aiofiles, asyncio
|
import aiohttp, aiofiles, asyncio
|
||||||
|
|
||||||
sys.path.append("./py2lib")
|
import py2Lib.bit
|
||||||
sys.path.append("./Util")
|
import util.machineProductCfg as MPC
|
||||||
sys.path.append("./records")
|
import records.lfRecord as LFR
|
||||||
import bit
|
|
||||||
import MachineProductCfg as MPC
|
|
||||||
import LFRecord as LFR
|
|
||||||
|
|
||||||
|
|
||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
@@ -32,7 +28,7 @@ l.debug(pollenIds, geocodes)
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -94,4 +90,4 @@ async def makeDataFile():
|
|||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("./.temp/PollenForecast.i2m")
|
os.remove("./.temp/PollenForecast.i2m")
|
||||||
os.remove("./.temp/PollenForecast.gz")
|
os.remove("./.temp/PollenForecast.gz")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
import datetime
|
import datetime
|
||||||
from py2Lib import bit
|
import py2Lib.bit
|
||||||
import Util.MachineProductCfg as MPC
|
import util.machineProductCfg as MPC
|
||||||
import records.LFRecord as LFR
|
import records.lfRecord as LFR
|
||||||
import gzip
|
import gzip
|
||||||
from os import remove
|
from os import remove
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@@ -21,7 +21,7 @@ for i in MPC.getTideStations():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -91,4 +91,4 @@ async def makeRecord():
|
|||||||
bit.sendFile([file], [command], 1, 0)
|
bit.sendFile([file], [command], 1, 0)
|
||||||
|
|
||||||
remove('./.temp/TidesForecast.i2m')
|
remove('./.temp/TidesForecast.i2m')
|
||||||
remove('./.temp/TidesForecast.gz')
|
remove('./.temp/TidesForecast.gz')
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
import logging,coloredlogs
|
import logging,coloredlogs
|
||||||
from py2Lib import bit
|
import py2Lib.bit
|
||||||
import Util.MachineProductCfg as MPC
|
import util.machineProductCfg as MPC
|
||||||
import records.LFRecord as LFR
|
import records.lfRecord as LFR
|
||||||
import gzip
|
import gzip
|
||||||
from os import remove
|
from os import remove
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@@ -21,7 +21,7 @@ for i in MPC.getPrimaryLocations():
|
|||||||
|
|
||||||
# Open the config file and make it accessible via "cfg"
|
# Open the config file and make it accessible via "cfg"
|
||||||
import json
|
import json
|
||||||
with open("conf.json", "r") as file:
|
with open("config.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg["twcApiKey"]
|
apiKey = cfg["twcApiKey"]
|
||||||
@@ -81,4 +81,4 @@ async def makeRecord():
|
|||||||
bit.sendFile([file], [command], 1, 0)
|
bit.sendFile([file], [command], 1, 0)
|
||||||
|
|
||||||
remove('./.temp/WateringNeeds.i2m')
|
remove('./.temp/WateringNeeds.i2m')
|
||||||
remove('./.temp/WateringNeeds.gz')
|
remove('./.temp/WateringNeeds.gz')
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user