Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 34 additions & 32 deletions homeassistant/components/doorbird/.translations/en.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
{
"config": {
"abort": {
"already_configured": "This DoorBird is already configured"
},
"error": {
"cannot_connect": "Failed to connect, please try again",
"invalid_auth": "Invalid authentication",
"unknown": "Unexpected error"
},
"step": {
"user": {
"data": {
"host": "Host (IP Address)",
"name": "Device Name",
"password": "Password",
"username": "Username"
},
"title": "Connect to the DoorBird"
"options" : {
"step" : {
"init" : {
"data" : {
"events" : "Comma separated list of events."
},
"description" : "Add an comma separated event name for each event you wish to track. After entering them here, use the DoorBird app to assign them to a specific event. See the documentation at https://www.home-assistant.io/integrations/doorbird/#events. Example: somebody_pressed_the_button, motion"
}
}
},
"config" : {
"step" : {
"user" : {
"title" : "Connect to the DoorBird",
"data" : {
"password" : "Password",
"host" : "Host (IP Address)",
"name" : "Device Name",
"username" : "Username"
}
},
"title": "DoorBird"
},
"options": {
"step": {
"init": {
"data": {
"events": "Comma separated list of events."
},
"description": "Add an comma separated event name for each event you wish to track. After entering them here, use the DoorBird app to assign them to a specific event. See the documentation at https://www.home-assistant.io/integrations/doorbird/#events. Example: somebody_pressed_the_button, motion"
}
}
}
}
}
},
"abort" : {
"already_configured" : "This DoorBird is already configured",
"link_local_address": "Link local addresses are not supported",
"not_doorbird_device": "This device is not a DoorBird"
},
"title" : "DoorBird",
"error" : {
"invalid_auth" : "Invalid authentication",
"unknown" : "Unexpected error",
"cannot_connect" : "Failed to connect, please try again"
}
}
}
2 changes: 2 additions & 0 deletions homeassistant/components/doorbird/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ async def async_step_zeroconf(self, discovery_info):

if macaddress[:6] != DOORBIRD_OUI:
return self.async_abort(reason="not_doorbird_device")
if discovery_info[CONF_HOST].startswith("169.254"):
Comment thread
bdraco marked this conversation as resolved.
return self.async_abort(reason="link_local_address")

await self.async_set_unique_id(macaddress)

Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/doorbird/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
}
},
"abort" : {
"already_configured" : "This DoorBird is already configured"
"already_configured" : "This DoorBird is already configured",
"link_local_address": "Link local addresses are not supported",
"not_doorbird_device": "This device is not a DoorBird"
},
"title" : "DoorBird",
"error" : {
Expand Down
23 changes: 23 additions & 0 deletions tests/components/doorbird/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,33 @@ async def test_form_zeroconf_wrong_oui(hass):
context={"source": config_entries.SOURCE_ZEROCONF},
data={
"properties": {"macaddress": "notdoorbirdoui"},
"host": "192.168.1.8",
"name": "Doorstation - abc123._axis-video._tcp.local.",
},
)
assert result["type"] == "abort"
assert result["reason"] == "not_doorbird_device"


async def test_form_zeroconf_link_local_ignored(hass):
"""Test we abort when we get a link local address via zeroconf."""
await hass.async_add_executor_job(
Comment thread
bdraco marked this conversation as resolved.
init_recorder_component, hass
) # force in memory db

await setup.async_setup_component(hass, "persistent_notification", {})

result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data={
"properties": {"macaddress": "1CCAE3DOORBIRD"},
"host": "169.254.103.61",
"name": "Doorstation - abc123._axis-video._tcp.local.",
},
)
assert result["type"] == "abort"
assert result["reason"] == "link_local_address"


async def test_form_zeroconf_correct_oui(hass):
Expand Down