Skip to content

Commit 41a2276

Browse files
Remove unused device link code from binary_sensor and button platforms (#4915)
1 parent a282110 commit 41a2276

2 files changed

Lines changed: 2 additions & 45 deletions

File tree

custom_components/battery_notes/binary_sensor.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from homeassistant.exceptions import TemplateError
3030
from homeassistant.helpers import (
3131
config_validation as cv,
32-
device_registry as dr,
3332
entity_registry as er,
3433
template,
3534
)
@@ -100,24 +99,6 @@ class BatteryNotesBinarySensorEntityDescription(
10099
)
101100

102101

103-
@callback
104-
def async_add_to_device(
105-
hass: HomeAssistant, entry: BatteryNotesConfigEntry
106-
) -> str | None:
107-
"""Add our config entry to the device."""
108-
device_registry = dr.async_get(hass)
109-
110-
device_id = entry.data.get(CONF_DEVICE_ID)
111-
112-
if device_id:
113-
if device_registry.async_get(device_id):
114-
device_registry.async_update_device(
115-
device_id, add_config_entry_id=entry.entry_id
116-
)
117-
return device_id
118-
return None
119-
120-
121102
async def async_setup_entry(
122103
hass: HomeAssistant,
123104
config_entry: BatteryNotesConfigEntry,

custom_components/battery_notes/button.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@
99
ButtonEntity,
1010
ButtonEntityDescription,
1111
)
12-
from homeassistant.const import (
13-
CONF_DEVICE_ID,
14-
)
15-
from homeassistant.core import HomeAssistant, callback
16-
from homeassistant.helpers import (
17-
device_registry as dr,
18-
entity_registry as er,
19-
)
12+
from homeassistant.core import HomeAssistant
13+
from homeassistant.helpers import entity_registry as er
2014
from homeassistant.helpers.entity import EntityCategory
2115
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
2216
from homeassistant.util import dt as dt_util
@@ -48,24 +42,6 @@ class BatteryNotesButtonEntityDescription(
4842
unique_id_suffix: str
4943

5044

51-
@callback
52-
def async_add_to_device(
53-
hass: HomeAssistant, entry: BatteryNotesConfigEntry
54-
) -> str | None:
55-
"""Add our config entry to the device."""
56-
device_registry = dr.async_get(hass)
57-
58-
device_id = entry.data.get(CONF_DEVICE_ID)
59-
60-
if device_id:
61-
if device_registry.async_get(device_id):
62-
device_registry.async_update_device(
63-
device_id, add_config_entry_id=entry.entry_id
64-
)
65-
return device_id
66-
return None
67-
68-
6945
async def async_setup_entry(
7046
hass: HomeAssistant,
7147
config_entry: BatteryNotesConfigEntry,

0 commit comments

Comments
 (0)