OpenWeatherMap API for outside temp

This commit is contained in:
Paul Warren 2022-11-22 14:36:48 +11:00
parent 9bb2ea34aa
commit 4ee05476fd
1 changed files with 8 additions and 0 deletions

View File

@ -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")