Skip to content

Commit

Permalink
Remove commented weather code
Browse files Browse the repository at this point in the history
  • Loading branch information
autoSteve committed Dec 30, 2024
1 parent ded175f commit 44cd6b0
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 53 deletions.
1 change: 0 additions & 1 deletion custom_components/solcast_solar/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ async def __forecast_update(self, force: bool = False, completion: str = ""):
await self.solcast.reset_usage_cache()
await self.__restart_time_track_midnight_update()

# await self.solcast.get_weather()
await self.solcast.get_forecast_update(do_past=False, force=force)
self._data_updated = True
await self.update_integration_listeners()
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@
suggested_display_precision=0,
state_class=SensorStateClass.MEASUREMENT,
),
# "weather_description": SensorEntityDescription(key="weather_description", translation_key="weather_description", icon="mdi:weather-partly-snowy-rainy",),
}


Expand Down
44 changes: 0 additions & 44 deletions custom_components/solcast_solar/solcastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ def __init__(
self._tally = {}
self._tz = options.tz
self._use_forecast_confidence = f"pv_{options.key_estimate}"
# self._weather = ""

self._config_dir = hass.config.config_dir
_LOGGER.debug("Configuration directory is %s", self._config_dir)
Expand Down Expand Up @@ -1234,43 +1233,6 @@ async def get_dampening(self, site: str) -> list:
translation_placeholders={"site": site},
) # pragma: no cover, not expected to be reached

'''
async def get_weather(self):
"""Request site weather byline."""
try:
if len(self.sites) > 0:
api_keys = self.options.api_key.split(",")
rid = self.sites[0].get("resource_id", None)
url=f"{self.options.host}/json/reply/GetRooftopSiteSparklines"
params = {"resourceId": rid, "api_key": api_keys[0]}
_LOGGER.debug("Get weather byline")
async with asyncio.timeout(60):
#async_timeout.timeout(60):
response: ClientResponse = await self._aiohttp_session.get(url=url, params=params, headers=self.headers, ssl=False)
response_json = await response.json(content_type=None)
status = response.status
if status == 200:
weather_data = cast(dict, response_json)
_LOGGER.debug("Returned data in get_weather(): %s", str(weather_data))
self._weather = weather_data.get("forecast_descriptor", None).get("description", None)
_LOGGER.debug("Weather description: %s", self._weather)
else:
raise Exception(f"Gathering weather description failed. request returned: {self.__translate(status)} - Response: {response_json}.")
except json.decoder.JSONDecodeError:
_LOGGER.error("JSONDecodeError in get_weather(): Solcast could be having problems")
except ConnectionRefusedError as e:
_LOGGER.error("Error in get_weather(): %s", e)
except ClientConnectionError as e:
_LOGGER.error("Connection error in get_weather(): %s", e)
except asyncio.TimeoutError:
_LOGGER.error("Connection error in get_weather(): Timed out connecting to solcast")
except Exception as e:
_LOGGER.error("Error in get_weather(): %s", traceback.format_exc())
'''

async def load_saved_data(self) -> str: # noqa: C901
"""Load the saved solcast.json data.
Expand All @@ -1289,7 +1251,6 @@ async def load_data(filename, set_loaded=True) -> dict | None:
async with aiofiles.open(filename) as data_file:
json_data = json.loads(await data_file.read(), cls=JSONDecoder)
json_version = json_data.get("version", 1)
# self._weather = json_data.get("weather", "unknown")
_LOGGER.debug(
"Data cache %s exists, file type is %s",
filename,
Expand Down Expand Up @@ -1539,10 +1500,6 @@ def get_api_limit(self) -> int:
"""
return min(list(self._api_limit.values()))

# def get_weather_description(self):
# """Return weather description."""
# return self._weather

def get_last_updated(self) -> dt:
"""Return when the data was last updated.
Expand Down Expand Up @@ -2454,7 +2411,6 @@ def next_update(): # pragma: no cover, testing only possible when running
sites_succeeded += 1

if sites_attempted > 0 and not failure:
# self._data["weather"] = self._weather
b_status = await self.build_forecast_data()
self._loaded_data = True

Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@
"total_kwh_forecast_d6": {"name": "Forecast Day 6"},
"total_kwh_forecast_d7": {"name": "Forecast Day 7"},
"power_now": {"name": "Power Now"},
"weather_description": {"name": "Weather"},
"hard_limit": {"name": "Hard Limit Set"},
"hard_limit_api": {"name": "Hard Limit Set {api_key}"}
},
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
"total_kwh_forecast_d6": {"name": "Prognose Tag 6"},
"total_kwh_forecast_d7": {"name": "Prognose Tag 7"},
"power_now": {"name": "Aktuelle Leistung"},
"weather_description": {"name": "Wetter"},
"hard_limit": {"name": "Fester Grenzwert eingestellt"},
"hard_limit_api": {"name": "Fester Grenzwert eingestellt {api_key}"}
},
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@
"total_kwh_forecast_d6": {"name": "Forecast Day 6"},
"total_kwh_forecast_d7": {"name": "Forecast Day 7"},
"power_now": {"name": "Power Now"},
"weather_description": {"name": "Weather"},
"hard_limit": {"name": "Hard Limit Set"},
"hard_limit_api": {"name": "Hard Limit Set {api_key}"}
},
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@
"total_kwh_forecast_d6": {"name": "Prévision jour 6"},
"total_kwh_forecast_d7": {"name": "Prévision jour 7"},
"power_now": {"name": "Puissance maintenant"},
"weather_description": {"name": "Météo"},
"hard_limit": {"name": "Ensemble de limites strictes"},
"hard_limit_api": {"name": "Ensemble de limites strictes {api_key}"}
},
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
"total_kwh_forecast_d6": {"name": "Prognoza na dzień 6"},
"total_kwh_forecast_d7": {"name": "Prognoza na dzień 7"},
"power_now": {"name": "Aktualna moc"},
"weather_description": {"name": "Pogoda"},
"hard_limit": {"name": "Ustawiony twardy limit"},
"hard_limit_api": {"name": "Ustawiony twardy limit {api_key}"}
},
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
"total_kwh_forecast_d6": {"name": "Predpoveď deň 6"},
"total_kwh_forecast_d7": {"name": "Predpoveď deň 7"},
"power_now": {"name": "Výkon teraz"},
"weather_description": {"name": "Počasie"},
"hard_limit": {"name": "Tvrdý limit nastavený"},
"hard_limit_api": {"name": "Tvrdý limit nastavený {api_key}"}
},
Expand Down
1 change: 0 additions & 1 deletion custom_components/solcast_solar/translations/ur.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
"total_kwh_forecast_d6": {"name": "دن 6 کی پیشن گوئی"},
"total_kwh_forecast_d7": {"name": "دن 7 کی پیشن گوئی"},
"power_now": {"name": "ابھی پاور"},
"weather_description": {"name": "موسم"},
"hard_limit": {"name": "سخت حد مقرر"},
"hard_limit_api": {"name": "سخت حد مقرر {api_key}"}
},
Expand Down

0 comments on commit 44cd6b0

Please sign in to comment.