Compare commits

...

2 Commits

Author SHA1 Message Date
Paul Warren 52e456f13d Fixes for new BOM_rrd python 2022-01-30 09:41:35 +11:00
Paul Warren 89ac550635 Readme updates 2022-01-29 08:14:50 +11:00
2 changed files with 14 additions and 12 deletions

View File

@ -1,12 +1,13 @@
# EPClock
ESP8226 Arduino based ePaper clock, using NTP and showing the weather.
Using a Waveshare 4.3" UART module and an ESP8226 R1 Mini from Jaycar Australia, which is a D1 Mini in the Arduino program.
Using a Waveshare 4.3" UART module and an ESP8226 R1 Mini from Jaycar Australia, which is a D1 R1 in the Arduino program.
The ESP8266 doesn't really have enough RAM to be able to parse the XML available from the Autralian Bureau of Meteorology, so the bom_xml.py script does that and spits out some simplified json I've put that json on my home web server, and set the script to run hourly.
The ESP8266 doesn't really have enough RAM to be able to parse the XML available from the Autralian Bureau of Meteorology, so the bom_xml.py script does that and spits out some simplified json I've put that json on my home web server, and set the script to run hourly.
I've also put in bom_rrd2.py which uses the 'weather-au' library from pip and also pulls some current temperatures from some MQTT sensors I have around the house.
## Required Libraries
## Required Arduino Libraries
Timezone: [https://github.com/JChristensen/Timezone]()
@ -29,4 +30,4 @@ Use Images/create_images.py edit for font choice! The current images are in Fre
## Weather Icons
I have derived some from the Australian Bureau of Meteorology, Feel free to use those, or make some better ones!
I have derived some from the Australian Bureau of Meteorology, Feel free to use those, or make some better ones!

View File

@ -28,11 +28,11 @@ bedroom_temp = 0
lounge = rrdtool.fetch("/media/media/mqtt/ESP_4c7682/temp.rrd", "AVERAGE")
rows = lounge[2][::-1]
for data in rows:
if data[0] is not None:
lounge_temp = int(data[0])
break
try:
lounge_temp = int(rows[1][0])
except TypeError:
lounge_temp = int(rows[2][0])
bom_icons = {
'sunny': 'SUNNY.JPG',
'clear': 'CLEAR.JPG',
@ -85,8 +85,8 @@ if night:
new[day]['icon'] = bom_icons[weather['today']['icon_descriptor']]
else:
new[day]['day'] = datetime.datetime.strptime(weather[day]['date'], "%Y-%m-%dT%H:%M:%S%z").strftime("%A")
new[day]['icon'] = bom_icons[weather['today']['icon_descriptor']]
new[day]['max'] = weather['today']['temp_max']
new[day]['icon'] = bom_icons[weather[day]['icon_descriptor']]
new[day]['max'] = weather[day]['temp_max']
else:
@ -103,6 +103,7 @@ new['current']['outside'] = outside_temp
new['current']['bedroom'] = bedroom_temp
new['current']['lounge'] = lounge_temp
with open('bom.json', 'w') as output:
with open('/var/www/darksky/bom.json', 'w') as output:
output.write(json.dumps(new))
output.close()