Skip to content

Commit

Permalink
Update bureau_of_meteorology
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaspence committed Aug 11, 2024
1 parent d2af652 commit 9261cd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions custom_components/bureau_of_meteorology/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
COORDINATOR: coordinator,
}

for component in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

update_listener = entry.add_update_listener(async_update_options)
hass.data[DOMAIN][entry.entry_id][UPDATE_LISTENER] = update_listener
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bureau_of_meteorology/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"zeroconf": [],
"homekit": {},
"dependencies": [],
"version": "1.2.0",
"version": "1.3.3",
"codeowners": ["@bremor,@makin-things"]
}
8 changes: 4 additions & 4 deletions custom_components/bureau_of_meteorology/sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Platform for sensor integration."""
import logging
from datetime import datetime, tzinfo
from datetime import datetime, tzinfo, timezone
from typing import Any

import iso8601
Expand Down Expand Up @@ -338,9 +338,9 @@ def state(self):
)
else:
utc = timezone.utc
local = timezone(self.collector.locations_data["data"]["timezone"])
start_time = utc.localize(datetime.strptime(self.collector.daily_forecasts_data["data"][self.day]["uv_start_time"], "%Y-%m-%dT%H:%M:%SZ")).astimezone(local)
end_time = utc.localize(datetime.strptime(self.collector.daily_forecasts_data["data"][self.day]["uv_end_time"], "%Y-%m-%dT%H:%M:%SZ")).astimezone(local)
local = zoneinfo.ZoneInfo(self.collector.locations_data["data"]["timezone"])
start_time = datetime.strptime(self.collector.daily_forecasts_data["data"][self.day]["uv_start_time"], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=utc).astimezone(local)
end_time = datetime.strptime(self.collector.daily_forecasts_data["data"][self.day]["uv_end_time"], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=utc).astimezone(local)
return (
f'Sun protection recommended from {start_time.strftime("%-I:%M%p").lower()} to '
f'{end_time.strftime("%-I:%M%p").lower()}, UV Index predicted to reach '
Expand Down

0 comments on commit 9261cd9

Please sign in to comment.