Add configflow to Proximity integration (#103894)
* add config flow * fix tests * adjust and fix tests * fix tests * config_zones as fixture * add config flow tests * use coordinator.async_config_entry_first_refresh * use entry.entry_id for hass.data * fix doc string * remove unused unit_of_measurement string key * don't store friendly_name, just use self.name * abort on matching entiry * break out legacy setup into seperate function * make tracked entites required * move _asnyc_setup_legacy to module level * use zone name as config entry title * add entity_used_in helper * check entry source if imported * create repair issue for removed tracked entities * separate state change from registry change event handling * migrate unique ids after tracked entity renamed * use full words for the variable names * use defaultdict * add test * remove unnecessary if not in check * use unique_id of tracked entity * use the entity registry entry id * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
c587c69915
commit
30c5baf522
13 changed files with 919 additions and 207 deletions
11
homeassistant/components/proximity/helpers.py
Normal file
11
homeassistant/components/proximity/helpers.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
"""Helper functions for proximity."""
|
||||
from homeassistant.components.automation import automations_with_entity
|
||||
from homeassistant.components.script import scripts_with_entity
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
def entity_used_in(hass: HomeAssistant, entity_id: str) -> list[str]:
|
||||
"""Get list of related automations and scripts."""
|
||||
used_in = automations_with_entity(hass, entity_id)
|
||||
used_in += scripts_with_entity(hass, entity_id)
|
||||
return used_in
|
Loading…
Add table
Add a link
Reference in a new issue