Skip to content

Commit 972ed4b

Browse files
authored
Finish removal of sensor.sun_solar_rising (home-assistant#157606)
1 parent 23c167d commit 972ed4b

File tree

4 files changed

+2
-95
lines changed

4 files changed

+2
-95
lines changed

homeassistant/components/sun/icons.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
},
3434
"solar_elevation": {
3535
"default": "mdi:theme-light-dark"
36-
},
37-
"solar_rising": {
38-
"default": "mdi:sun-clock"
3936
}
4037
}
4138
}

homeassistant/components/sun/sensor.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
1919
from homeassistant.helpers.dispatcher import async_dispatcher_connect
2020
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
21-
from homeassistant.helpers.issue_registry import (
22-
IssueSeverity,
23-
async_create_issue,
24-
async_delete_issue,
25-
)
2621
from homeassistant.helpers.typing import StateType
2722

2823
from .const import DOMAIN, SIGNAL_EVENTS_CHANGED, SIGNAL_POSITION_CHANGED
@@ -100,13 +95,6 @@ class SunSensorEntityDescription(SensorEntityDescription):
10095
native_unit_of_measurement=DEGREE,
10196
signal=SIGNAL_POSITION_CHANGED,
10297
),
103-
SunSensorEntityDescription(
104-
key="solar_rising",
105-
translation_key="solar_rising",
106-
value_fn=lambda data: data.rising,
107-
entity_registry_enabled_default=False,
108-
signal=SIGNAL_EVENTS_CHANGED,
109-
),
11098
)
11199

112100

@@ -155,30 +143,10 @@ async def async_added_to_hass(self) -> None:
155143
"""Register signal listener when added to hass."""
156144
await super().async_added_to_hass()
157145

158-
if self.entity_description.key == "solar_rising":
159-
async_create_issue(
160-
self.hass,
161-
DOMAIN,
162-
"deprecated_sun_solar_rising",
163-
breaks_in_ha_version="2026.1.0",
164-
is_fixable=False,
165-
severity=IssueSeverity.WARNING,
166-
translation_key="deprecated_sun_solar_rising",
167-
translation_placeholders={
168-
"entity": self.entity_id,
169-
},
170-
)
171-
172146
self.async_on_remove(
173147
async_dispatcher_connect(
174148
self.hass,
175149
self.entity_description.signal,
176150
self.async_write_ha_state,
177151
)
178152
)
179-
180-
async def async_will_remove_from_hass(self) -> None:
181-
"""Call when entity will be removed from hass."""
182-
await super().async_will_remove_from_hass()
183-
if self.entity_description.key == "solar_rising":
184-
async_delete_issue(self.hass, DOMAIN, "deprecated_sun_solar_rising")

homeassistant/components/sun/strings.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"next_rising": { "name": "Next rising" },
2525
"next_setting": { "name": "Next setting" },
2626
"solar_azimuth": { "name": "Solar azimuth" },
27-
"solar_elevation": { "name": "Solar elevation" },
28-
"solar_rising": { "name": "Solar rising" }
27+
"solar_elevation": { "name": "Solar elevation" }
2928
}
3029
},
3130
"entity_component": {
@@ -37,11 +36,5 @@
3736
}
3837
}
3938
},
40-
"issues": {
41-
"deprecated_sun_solar_rising": {
42-
"description": "The 'Solar rising' sensor of the Sun integration is being deprecated; an equivalent 'Solar rising' binary sensor has been made available as a replacement. To resolve this issue, disable {entity}.",
43-
"title": "Deprecated 'Solar rising' sensor"
44-
}
45-
},
4639
"title": "Sun"
4740
}

tests/components/sun/test_sensor.py

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
import pytest
99

1010
from homeassistant.components import sun
11-
from homeassistant.config_entries import RELOAD_AFTER_UPDATE_DELAY
1211
from homeassistant.const import EntityCategory
1312
from homeassistant.core import HomeAssistant
14-
from homeassistant.helpers import entity_registry as er, issue_registry as ir
13+
from homeassistant.helpers import entity_registry as er
1514
from homeassistant.setup import async_setup_component
1615
from homeassistant.util import dt as dt_util
1716

18-
from tests.common import async_fire_time_changed
19-
2017

2118
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
2219
async def test_setting_rising(
@@ -177,51 +174,3 @@ async def test_setting_rising(
177174
assert entity
178175
assert entity.entity_category is EntityCategory.DIAGNOSTIC
179176
assert entity.unique_id == f"{entry_ids[0].entry_id}-solar_azimuth"
180-
181-
entity = entity_registry.async_get("sensor.sun_solar_rising")
182-
assert entity
183-
assert entity.entity_category is EntityCategory.DIAGNOSTIC
184-
assert entity.unique_id == f"{entry_ids[0].entry_id}-solar_rising"
185-
186-
187-
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
188-
async def test_deprecation(
189-
hass: HomeAssistant,
190-
entity_registry: er.EntityRegistry,
191-
issue_registry: ir.IssueRegistry,
192-
freezer: FrozenDateTimeFactory,
193-
) -> None:
194-
"""Test sensor.sun_solar_rising deprecation."""
195-
utc_now = datetime(2016, 11, 1, 8, 0, 0, tzinfo=dt_util.UTC)
196-
freezer.move_to(utc_now)
197-
await async_setup_component(hass, sun.DOMAIN, {sun.DOMAIN: {}})
198-
await hass.async_block_till_done()
199-
200-
assert issue_registry.async_get_issue(
201-
domain="sun",
202-
issue_id="deprecated_sun_solar_rising",
203-
)
204-
assert len(issue_registry.issues) == 1
205-
206-
entity_registry.async_update_entity(
207-
"sensor.sun_solar_rising", disabled_by=er.RegistryEntryDisabler.USER
208-
)
209-
await hass.async_block_till_done()
210-
211-
assert not issue_registry.async_get_issue(
212-
domain="sun",
213-
issue_id="deprecated_sun_solar_rising",
214-
)
215-
assert len(issue_registry.issues) == 0
216-
217-
entity_registry.async_update_entity("sensor.sun_solar_rising", disabled_by=None)
218-
await hass.async_block_till_done()
219-
freezer.tick(delta=RELOAD_AFTER_UPDATE_DELAY)
220-
async_fire_time_changed(hass)
221-
await hass.async_block_till_done()
222-
223-
assert issue_registry.async_get_issue(
224-
domain="sun",
225-
issue_id="deprecated_sun_solar_rising",
226-
)
227-
assert len(issue_registry.issues) == 1

0 commit comments

Comments
 (0)