File tree Expand file tree Collapse file tree
custom_components/battery_notes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929from homeassistant .exceptions import TemplateError
3030from 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-
121102async def async_setup_entry (
122103 hass : HomeAssistant ,
123104 config_entry : BatteryNotesConfigEntry ,
Original file line number Diff line number Diff line change 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
2014from homeassistant .helpers .entity import EntityCategory
2115from homeassistant .helpers .entity_platform import AddConfigEntryEntitiesCallback
2216from 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-
6945async def async_setup_entry (
7046 hass : HomeAssistant ,
7147 config_entry : BatteryNotesConfigEntry ,
You can’t perform that action at this time.
0 commit comments