Silly clock + weather or other rss every 60 or 300 seconds
aintnogeek opened this issue · 0 comments
aintnogeek commented
Hello,
I have silly clock running and I want to display weather with rss feed every minute.
I have no clue how to combine silly clock with weather.
My weather rss feed. python file
!/usr/bin/env python
from luma.core.legacy import text, show_message
from luma.core.interface.serial import spi, noop
import time
from random import randrange
from luma.led_matrix.device import max7219
import luma.led_matrix.device as led
from luma.core.legacy.font import proportional, SINCLAIR_FONT, TINY_FONT, CP437_FONT
import feedparser
python_wiki_rss_url = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/456172"
# create matrix device
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=4, block_orientation=-90, blocks_arranged_in_reverse_order=True)
device.contrast(16)
print("Created device")
while True:
print("Getting feed")
feed = feedparser.parse( python_wiki_rss_url)
for repeats in range(100):
print(repeats)
for items in feed["items"]:
msg = items["title"]
msg = msg[0:msg.find("/")]
print(msg)
show_message(device, msg, fill="white", font=proportional(CP437_FONT))
time.sleep(60)
# msg = items["description"]
# msg = msg[0:msg.find("/")]
# print(msg)
# show_message(device, msg, fill="white", font=proportional(CP437_FONT))
# time.sleep(90)
msg = time.asctime()
msg= time.strftime("%H:%M")
print(msg)
show_message(device, msg, fill="white", font=proportional(CP437_FONT))
time.sleep(1)