Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aurora alert sensor always Off #127780

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions homeassistant/components/aurora/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant

from .const import CONF_THRESHOLD, DEFAULT_THRESHOLD
from .coordinator import AuroraDataUpdateCoordinator

PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
Expand All @@ -21,9 +22,17 @@

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

entry.async_on_unload(entry.add_update_listener(update_listener))

Check warning on line 25 in homeassistant/components/aurora/__init__.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/aurora/__init__.py#L25

Added line #L25 was not covered by tests
return True


async def update_listener(hass: HomeAssistant, entry: AuroraConfigEntry) -> None:
"""Handle options update."""
entry.runtime_data.threshold = int(

Check warning on line 31 in homeassistant/components/aurora/__init__.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/aurora/__init__.py#L31

Added line #L31 was not covered by tests
frenck marked this conversation as resolved.
Show resolved Hide resolved
entry.options.get(CONF_THRESHOLD, DEFAULT_THRESHOLD)
)


async def async_unload_entry(hass: HomeAssistant, entry: AuroraConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)