import urllib.request
import astral # type: ignore
from astral.sun import sun # type: ignore
from bs4 import BeautifulSoup # type: ignore
import urllib.request
import astral # type: ignore
from astral.sun import sun # type: ignore
from bs4 import BeautifulSoup # type: ignore
def __init__(self, forecasts = None):
if forecasts is not None:
self.forecasts = forecasts
def __init__(self, forecasts = None):
if forecasts is not None:
self.forecasts = forecasts
- www = urllib.request.urlopen(
- "http://10.0.0.75/~pi/outside_temp"
+ current_temp = temps.ThermometerRegistry().read_temperature(
+ 'house_outside', convert_to_fahrenheit=True
- if dt.date == now.date:
- blurb = f'{day.get_text()}: The current outside tempterature is {current_temp}. ' + txt.get_text()
+ if dt.date() == now.date() and not said_temp and current_temp is not None:
+ blurb = f'{day.get_text()}: The current outside tempterature is {current_temp}. '
+ blurb += txt.get_text()
+ said_temp = True
else:
blurb = f'{day.get_text()}: {txt.get_text()}'
blurb = text_utils.wrap_string(blurb, 80)
else:
blurb = f'{day.get_text()}: {txt.get_text()}'
blurb = text_utils.wrap_string(blurb, 80)
if persistent.was_file_written_within_n_seconds(
config.config['weather_forecast_cachefile'],
config.config['weather_forecast_stalest_acceptable'].total_seconds(),
if persistent.was_file_written_within_n_seconds(
config.config['weather_forecast_cachefile'],
config.config['weather_forecast_stalest_acceptable'].total_seconds(),