Skip to content

Commit

Permalink
Added chance of rain
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGos committed Sep 20, 2023
1 parent 312f415 commit 0536db1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/.DS_Store
.DS_Store
/.venv
2 changes: 1 addition & 1 deletion custom_components/gfs_weather_forecast/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Platforms
WEATHER = "weather"

DEFAULT_SYNC_INTERVAL = 30 # seconds
DEFAULT_SYNC_INTERVAL = 15 # seconds

CONF_API_PORT = 8000

Expand Down
2 changes: 1 addition & 1 deletion custom_components/gfs_weather_forecast/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "gfs_weather_forecast",
"name": "GFS Weather Forecast",
"version": "0.0.1",
"version": "1.0.2",
"config_flow": true,
"documentation": "https://github.com/MarcoGos/gfs_weather_forecast",
"requirements": [],
Expand Down
16 changes: 9 additions & 7 deletions custom_components/gfs_weather_forecast/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ATTR_CONDITION_SUNNY,
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_NATIVE_PRECIPITATION,
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
ATTR_FORECAST_NATIVE_TEMP,
ATTR_FORECAST_NATIVE_TEMP_LOW,
ATTR_FORECAST_NATIVE_WIND_SPEED,
Expand Down Expand Up @@ -97,13 +98,13 @@ def _get_forecast(self) -> list[Forecast] | None:
forecast_date = datetime.fromisoformat(key).date()
if forecast_date > datetime.today().date():
chance_of_sun = forecast_data[key].get('chance_of_sun')
rain = forecast_data[key].get('rain')
min_temperature_daytime = forecast_data[key].get('min_temperature_daytime')
temperature_min = round(forecast_data[key].get('temperature_min'))
temperature_max = round(forecast_data[key].get('temperature_max'))
rain = forecast_data[key].get('rain')
windangle = forecast_data[key].get('windangle')
windspeed = forecast_data[key].get('windspeed')
min_temperature_daytime = forecast_data[key].get('min_temperature_daytime', -999)
temperature_min = round(forecast_data[key].get('temperature_min', -999))
temperature_max = round(forecast_data[key].get('temperature_max', -999))
rain = forecast_data[key].get('rain', 0)
chance_of_rain = forecast_data[key].get('chance_of_rain', 0)
windangle = forecast_data[key].get('windangle', 0)
windspeed = forecast_data[key].get('windspeed', 0)
if temperature_max > -999 and temperature_min > -999:
next_day = {
ATTR_FORECAST_TIME: key,
Expand All @@ -112,6 +113,7 @@ def _get_forecast(self) -> list[Forecast] | None:
ATTR_FORECAST_NATIVE_TEMP_LOW: temperature_min,
ATTR_FORECAST_NATIVE_TEMP: temperature_max,
ATTR_FORECAST_NATIVE_PRECIPITATION: rain,
ATTR_FORECAST_PRECIPITATION_PROBABILITY: chance_of_rain,
ATTR_FORECAST_WIND_BEARING: windangle,
ATTR_FORECAST_NATIVE_WIND_SPEED: windspeed
}
Expand Down

0 comments on commit 0536db1

Please sign in to comment.