Hallo,
ich versuche gerade eine Vorhersage des Solar-Ertrag zu implementieren:
Ich bekomme in der Zeile
den Fehler
Was mache ich falsch?
Gruß,
Hendrik
ich versuche gerade eine Vorhersage des Solar-Ertrag zu implementieren:
Code:
import asyncio import dataclasses from datetime import datetime, timezone, timedelta from pprint import pprint from forecast_solar import ForecastSolar, ForecastSolarRatelimit async def main(): """Simple function to test the output.""" async with ForecastSolar( latitude=52.16, longitude=4.47, declination=20, azimuth=10, kwp=2.160, damping=0, horizon="0,0,0,10,10,20,20,30,30", ) as forecast: try: estimate = await forecast.estimate() except ForecastSolarRatelimit as err: print("Ratelimit reached") print(f"Rate limit resets at {err.reset_at}") reset_period = err.reset_at - datetime.now(timezone.utc) # Strip microseconds as they are not informative reset_period -= timedelta(microseconds=reset_period.microseconds) print(f"That's in {reset_period}") return pprint(dataclasses.asdict(estimate)) print() logger.error(f"energy_production_today: {estimate.energy_production_today}") asyncio.run(main()) logger.error("forecastsolar")
Code:
async with ForecastSolar
2022-09-30 13:09:57 ERROR logics.forecastsolar In der Logik ist ein Fehler aufgetreten:
Logik 'forecastsolar', Datei '/usr/local/smarthome/logics/forecastsolar.py', Zeile 11
function main(), Exception: name 'ForecastSolar' is not defined
Logik 'forecastsolar', Datei '/usr/local/smarthome/logics/forecastsolar.py', Zeile 11
function main(), Exception: name 'ForecastSolar' is not defined
Gruß,
Hendrik
Kommentar