8000 Deprecate hddtemp by edenhaus · Pull Request #145850 · home-assistant/core · GitHub
[go: up one dir, main page]

Skip to content

Deprecate hddtemp #145850

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

Merged
merged 1 commit into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions homeassistant/components/hddtemp/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"""The hddtemp component."""

DOMAIN = "hddtemp"
20 changes: 19 additions & 1 deletion homeassistant/components/hddtemp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
CONF_PORT,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, 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 DOMAIN

_LOGGER = logging.getLogger(__name__)

ATTR_DEVICE = "device"
Expand Down Expand Up @@ -56,6 +59,21 @@ def setup_platform(
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the HDDTemp sensor."""
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": "hddtemp",
},
)

name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
Expand Down
21 changes: 19 additions & 2 deletions tests/components/hddtemp/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""The tests for the hddtemp platform."""

import socket
from unittest.mock import patch
from unittest.mock import Mock, patch

import pytest

from homeassistant.components.hddtemp import DOMAIN
from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN
from homeassistant.const import UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.helpers import issue_registry as ir
from homeassistant.setup import async_setup_component

VALID_CONFIG_MINIMAL = {"sensor": {"platform": "hddtemp"}}
Expand Down Expand Up @@ -192,3 +195,17 @@ async def test_hddtemp_host_unreachable(hass: HomeAssistant, telnetmock) -> None
assert await async_setup_component(hass, "sensor", VALID_CONFIG_HOST_UNREACHABLE)
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 0


@patch.dict("sys.modules", gsp=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, VALID_CONFIG_MINIMAL)
await hass.async_block_till_done()
assert (
HOMEASSISTANT_DOMAIN,
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
) in issue_registry.issues
0