Display Homekit QR code when pairing (#34449)

* Display a QR code for homekit pairing

This will reduce the failure rate with HomeKit
pairing because there is less chance of entry
error.

* Add coverage

* Test that the qr code is created

* I cannot spell

* Update homeassistant/components/homekit/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/homekit/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston
2020-04-21 17:38:43 -05:00
committed by GitHub
parent ca08b70984
commit d06fce6997
10 changed files with 75 additions and 14 deletions

View File

@@ -10,6 +10,8 @@ from homeassistant.components.homekit.const import (
FEATURE_ON_OFF,
FEATURE_PLAY_PAUSE,
HOMEKIT_NOTIFY_ID,
HOMEKIT_PAIRING_QR,
HOMEKIT_PAIRING_QR_SECRET,
TYPE_FAUCET,
TYPE_OUTLET,
TYPE_SHOWER,
@@ -199,8 +201,10 @@ async def test_show_setup_msg(hass):
call_create_notification = async_mock_service(hass, DOMAIN, "create")
await hass.async_add_executor_job(show_setup_message, hass, pincode)
await hass.async_add_executor_job(show_setup_message, hass, pincode, "X-HM://0")
await hass.async_block_till_done()
assert hass.data[HOMEKIT_PAIRING_QR_SECRET]
assert hass.data[HOMEKIT_PAIRING_QR]
assert call_create_notification
assert call_create_notification[0].data[ATTR_NOTIFICATION_ID] == HOMEKIT_NOTIFY_ID