From 4ee05476fd53828cfc1b9415ed0fd09a5ddd3070 Mon Sep 17 00:00:00 2001 From: Paul Warren Date: Tue, 22 Nov 2022 14:36:48 +1100 Subject: [PATCH] OpenWeatherMap API for outside temp --- bom_rrd2.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bom_rrd2.py b/bom_rrd2.py index 9974a2c..65753a4 100755 --- a/bom_rrd2.py +++ b/bom_rrd2.py @@ -10,6 +10,11 @@ import rrdtool from weather_au import api from dateutil import tz +from pyowm import OWM + +owm = OWM('API KEY GOES HERE') +mgr = owm.weather_manager() + # Grab current temps from sensors around the house #outside = rrdtool.fetch("/media/media/mqtt/ESP_b5952/temp/c.rrd", "AVERAGE") #rows = outside[2][::-1] @@ -17,6 +22,9 @@ from dateutil import tz # if data[0] is not None: # outside_temp = data[0] # break + +# Grab outside temp from OpenWeatherMap +observation = mgr.one_call(lat=42.9696, lon=147.2004, exclude='minutely,hourly,daily', units='metric') outside_temp = int(observation.current.temperature()['temp']) #bedroom = rrdtool.fetch("/media/media/mqtt/ESP_b3fe20/temp.rrd", "AVERAGE")