Commit d3d77a49 authored by Cédric Crettaz's avatar Cédric Crettaz 🖥
Browse files

Correction of a bug in the DCA Carouge for weather.

parent 1610660b
......@@ -383,6 +383,7 @@ def collect():
:return:
"""
weather_data = get_data_from_weather_service()
if weather_data:
filepath = os.path.join(COLLECTION_DIR,'{}_weather_raw_data.json'.format(int(time.time())))
with open(filepath, encoding='utf-8', mode='w') as f:
......@@ -393,6 +394,8 @@ def collect():
logger.info("Dumping to FS {}".format(filepath))
return filepath
else:
return None
def main():
......@@ -401,7 +404,7 @@ def main():
while True:
logger.info("Querying external service for Weather data")
filepath = collect()
if filepath:
logger.info("Converting data to harmozined format")
data = convert_raw_to_weather_data_model(filepath)
......@@ -410,6 +413,8 @@ def main():
logger.info("Updated successfully WeatherObserved in IoT Platform")
time.sleep(POST_DATA_PERIOD)
else:
time.sleep(POST_DATA_PERIOD)
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment