* Config flow for doorbird * Discoverable via zeroconf * Fix zeroconf test * add missing return * Add a test for legacy over ride url (will go away when refactored to cloud hooks) * Update homeassistant/components/doorbird/__init__.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * without getting the hooks its not so useful * Update homeassistant/components/doorbird/config_flow.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * fix copy pasta * remove identifiers since its in connections * self review fixes Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
19 lines
610 B
Python
19 lines
610 B
Python
"""DoorBird integration utils."""
|
|
|
|
from .const import DOMAIN, DOOR_STATION
|
|
|
|
|
|
def get_mac_address_from_doorstation_info(doorstation_info):
|
|
"""Get the mac address depending on the device type."""
|
|
if "PRIMARY_MAC_ADDR" in doorstation_info:
|
|
return doorstation_info["PRIMARY_MAC_ADDR"]
|
|
return doorstation_info["WIFI_MAC_ADDR"]
|
|
|
|
|
|
def get_doorstation_by_token(hass, token):
|
|
"""Get doorstation by slug."""
|
|
for config_entry_id in hass.data[DOMAIN]:
|
|
doorstation = hass.data[DOMAIN][config_entry_id][DOOR_STATION]
|
|
|
|
if token == doorstation.token:
|
|
return doorstation
|