diff --git a/homeassistant/components/eddystone_temperature/__init__.py b/homeassistant/components/eddystone_temperature/__init__.py index 2d6f92498bd..af37eb629b5 100644 --- a/homeassistant/components/eddystone_temperature/__init__.py +++ b/homeassistant/components/eddystone_temperature/__init__.py @@ -1 +1,6 @@ """The eddystone_temperature component.""" + +DOMAIN = "eddystone_temperature" +CONF_BEACONS = "beacons" +CONF_INSTANCE = "instance" +CONF_NAMESPACE = "namespace" diff --git a/homeassistant/components/eddystone_temperature/sensor.py b/homeassistant/components/eddystone_temperature/sensor.py index 1047c52e111..7b8e726cf45 100644 --- a/homeassistant/components/eddystone_temperature/sensor.py +++ b/homeassistant/components/eddystone_temperature/sensor.py @@ -23,17 +23,18 @@ from homeassistant.const import ( STATE_UNKNOWN, UnitOfTemperature, ) -from homeassistant.core import Event, HomeAssistant +from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, Event, HomeAssistant from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.issue_registry import IssueSeverity, create_issue from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +from . import CONF_BEACONS, CONF_INSTANCE, CONF_NAMESPACE, DOMAIN + _LOGGER = logging.getLogger(__name__) -CONF_BEACONS = "beacons" CONF_BT_DEVICE_ID = "bt_device_id" -CONF_INSTANCE = "instance" -CONF_NAMESPACE = "namespace" + BEACON_SCHEMA = vol.Schema( { @@ -58,6 +59,21 @@ def setup_platform( discovery_info: DiscoveryInfoType | None = None, ) -> None: """Validate configuration, create devices and start monitoring thread.""" + create_issue( + hass, + HOMEASSISTANT_DOMAIN, + f"deprecated_system_packages_yaml_integration_{DOMAIN}", + breaks_in_ha_version="2025.12.0", + is_fixable=False, + issue_domain=DOMAIN, + severity=IssueSeverity.WARNING, + translation_key="deprecated_system_packages_yaml_integration", + translation_placeholders={ + "domain": DOMAIN, + "integration_title": "Eddystone", + }, + ) + bt_device_id: int = config[CONF_BT_DEVICE_ID] beacons: dict[str, dict[str, str]] = config[CONF_BEACONS] diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ac12172efac..19c114abfeb 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -533,6 +533,9 @@ babel==2.15.0 # homeassistant.components.homekit base36==0.1.1 +# homeassistant.components.eddystone_temperature +# beacontools[scan]==2.1.0 + # homeassistant.components.scrape beautifulsoup4==4.13.3 diff --git a/tests/components/eddystone_temperature/__init__.py b/tests/components/eddystone_temperature/__init__.py new file mode 100644 index 00000000000..af67530c946 --- /dev/null +++ b/tests/components/eddystone_temperature/__init__.py @@ -0,0 +1 @@ +"""Tests for eddystone temperature.""" diff --git a/tests/components/eddystone_temperature/test_sensor.py b/tests/components/eddystone_temperature/test_sensor.py new file mode 100644 index 00000000000..056681fdb90 --- /dev/null +++ b/tests/components/eddystone_temperature/test_sensor.py @@ -0,0 +1,45 @@ +"""Tests for eddystone temperature.""" + +from unittest.mock import Mock, patch + +from homeassistant.components.eddystone_temperature import ( + CONF_BEACONS, + CONF_INSTANCE, + CONF_NAMESPACE, + DOMAIN, +) +from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN +from homeassistant.const import CONF_PLATFORM +from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant +from homeassistant.helpers import issue_registry as ir +from homeassistant.setup import async_setup_component + + +@patch.dict("sys.modules", beacontools=Mock()) +async def test_repair_issue_is_created( + hass: HomeAssistant, + issue_registry: ir.IssueRegistry, +) -> None: + """Test repair issue is created.""" + assert await async_setup_component( + hass, + PLATFORM_DOMAIN, + { + PLATFORM_DOMAIN: [ + { + CONF_PLATFORM: DOMAIN, + CONF_BEACONS: { + "living_room": { + CONF_NAMESPACE: "112233445566778899AA", + CONF_INSTANCE: "000000000001", + } + }, + } + ], + }, + ) + await hass.async_block_till_done() + assert ( + HOMEASSISTANT_DOMAIN, + f"deprecated_system_packages_yaml_integration_{DOMAIN}", + ) in issue_registry.issues