Compare commits

..

5 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
3bae7760d8 Remove EVENT_LABS_UPDATED re-export from labs/const.py
Import EVENT_LABS_UPDATED directly from homeassistant.const in
labs/__init__.py and labs/websocket_api.py instead of re-exporting
from labs/const.py.

Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
2025-11-30 04:21:22 +00:00
copilot-swe-agent[bot]
512cbd17b1 Move EVENT_LABS_UPDATED to homeassistant/const.py
Move the constant to the central const.py file to avoid circular
import issues. Update labs/const.py to re-export from homeassistant.const
and update events.py to import from homeassistant.const directly.

Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
2025-11-30 04:17:22 +00:00
copilot-swe-agent[bot]
299c1a9c2d Fix import to use component root instead of submodule
Import EVENT_LABS_UPDATED from homeassistant.components.labs
instead of homeassistant.components.labs.const per
hass-component-root-import rule.

Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
2025-11-30 03:59:51 +00:00
copilot-swe-agent[bot]
c9b69ee297 Add EVENT_LABS_UPDATED to event subscription allowlist
This fixes the authorization error for non-admin users subscribing
to the labs_updated event, which was causing issues with kiosk mode
and dedicated dashboards in the beta version.

Fixes home-assistant/core#145771

Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
2025-11-29 20:51:44 +00:00
copilot-swe-agent[bot]
550ef72437 Initial plan 2025-11-29 20:45:35 +00:00
8 changed files with 10 additions and 36 deletions

View File

@@ -7,6 +7,7 @@ from typing import Any, Final
from homeassistant.const import (
EVENT_COMPONENT_LOADED,
EVENT_CORE_CONFIG_UPDATE,
EVENT_LABS_UPDATED,
EVENT_LOVELACE_UPDATED,
EVENT_PANELS_UPDATED,
EVENT_RECORDER_5MIN_STATISTICS_GENERATED,
@@ -45,6 +46,7 @@ SUBSCRIBE_ALLOWLIST: Final[set[EventType[Any] | str]] = {
EVENT_STATE_CHANGED,
EVENT_THEMES_UPDATED,
EVENT_LABEL_REGISTRY_UPDATED,
EVENT_LABS_UPDATED,
EVENT_CATEGORY_REGISTRY_UPDATED,
EVENT_FLOOR_REGISTRY_UPDATED,
}

View File

@@ -17,7 +17,7 @@ from aiohasupervisor.models import GreenOptions, YellowOptions # noqa: F401
import voluptuous as vol
from homeassistant.auth.const import GROUP_ID_ADMIN
from homeassistant.components import frontend, panel_custom
from homeassistant.components import panel_custom
from homeassistant.components.homeassistant import async_set_stop_handler
from homeassistant.components.http import StaticPathConfig
from homeassistant.config_entries import SOURCE_SYSTEM, ConfigEntry
@@ -329,7 +329,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
return False
async_load_websocket_api(hass)
frontend.async_register_built_in_panel(hass, "app")
host = os.environ["SUPERVISOR"]
websession = async_get_clientsession(hass)

View File

@@ -10,6 +10,7 @@ from __future__ import annotations
from collections.abc import Callable
import logging
from homeassistant.const import EVENT_LABS_UPDATED
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.generated.labs import LABS_PREVIEW_FEATURES
from homeassistant.helpers import config_validation as cv
@@ -17,7 +18,7 @@ from homeassistant.helpers.storage import Store
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import async_get_custom_components
from .const import DOMAIN, EVENT_LABS_UPDATED, LABS_DATA, STORAGE_KEY, STORAGE_VERSION
from .const import DOMAIN, LABS_DATA, STORAGE_KEY, STORAGE_VERSION
from .models import (
EventLabsUpdatedData,
LabPreviewFeature,

View File

@@ -11,6 +11,4 @@ DOMAIN = "labs"
STORAGE_KEY = "core.labs"
STORAGE_VERSION = 1
EVENT_LABS_UPDATED = "labs_updated"
LABS_DATA: HassKey[LabsData] = HassKey(DOMAIN)

View File

@@ -8,9 +8,10 @@ import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.components.backup import async_get_manager
from homeassistant.const import EVENT_LABS_UPDATED
from homeassistant.core import HomeAssistant, callback
from .const import EVENT_LABS_UPDATED, LABS_DATA
from .const import LABS_DATA
from .models import EventLabsUpdatedData

View File

@@ -92,11 +92,7 @@ def _get_camera_channels(
# no RTSP enabled use first channel with no stream
if is_default and not camera.is_third_party_camera:
# Only create repair issue if RTSP is not disabled globally
if not data.disable_stream:
_create_rtsp_repair(hass, entry, data, camera)
else:
ir.async_delete_issue(hass, DOMAIN, f"rtsp_disabled_{camera.id}")
_create_rtsp_repair(hass, entry, data, camera)
yield camera, camera.channels[0], True
else:
ir.async_delete_issue(hass, DOMAIN, f"rtsp_disabled_{camera.id}")

View File

@@ -271,6 +271,7 @@ EVENT_HOMEASSISTANT_STOP: EventType[NoEventData] = EventType("homeassistant_stop
EVENT_HOMEASSISTANT_FINAL_WRITE: EventType[NoEventData] = EventType(
"homeassistant_final_write"
)
EVENT_LABS_UPDATED: Final = "labs_updated"
EVENT_LOGBOOK_ENTRY: Final = "logbook_entry"
EVENT_LOGGING_CHANGED: Final = "logging_changed"
EVENT_SERVICE_REGISTERED: Final = "service_registered"

View File

@@ -7,10 +7,9 @@ from unittest.mock import AsyncMock
from uiprotect.data import Camera, CloudAccount, Version
from homeassistant.components.unifiprotect.const import CONF_DISABLE_RTSP, DOMAIN
from homeassistant.components.unifiprotect.const import DOMAIN
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir
from .utils import MockUFPFixture, init_entry
@@ -283,26 +282,3 @@ async def test_rtsp_no_fix_if_third_party(
assert msg["success"]
assert not msg["result"]["issues"]
async def test_rtsp_no_fix_if_globally_disabled(
hass: HomeAssistant,
ufp: MockUFPFixture,
doorbell: Camera,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test no RTSP disabled warning if RTSP is globally disabled on integration."""
for channel in doorbell.channels:
channel.is_rtsp_enabled = False
# Set RTSP globally disabled in config entry options
hass.config_entries.async_update_entry(
ufp.entry,
options={**ufp.entry.options, CONF_DISABLE_RTSP: True},
)
await init_entry(hass, ufp, [doorbell])
await async_process_repairs_platforms(hass)
assert len(issue_registry.issues) == 0