From 1904019b5f1c6cce6ccd6047777d000f6b9d6fc8 Mon Sep 17 00:00:00 2001 From: Zac West <74188+zacwest@users.noreply.github.com> Date: Mon, 18 Oct 2021 19:29:13 -0700 Subject: [PATCH] Include webhook_id in mobile_app's notify registration_info (#58007) --- homeassistant/components/mobile_app/const.py | 1 + homeassistant/components/mobile_app/notify.py | 2 ++ tests/components/mobile_app/test_notify.py | 1 + 3 files changed, 4 insertions(+) diff --git a/homeassistant/components/mobile_app/const.py b/homeassistant/components/mobile_app/const.py index e375ec55ff2..48fed416c33 100644 --- a/homeassistant/components/mobile_app/const.py +++ b/homeassistant/components/mobile_app/const.py @@ -49,6 +49,7 @@ ATTR_VERTICAL_ACCURACY = "vertical_accuracy" ATTR_WEBHOOK_DATA = "data" ATTR_WEBHOOK_ENCRYPTED = "encrypted" ATTR_WEBHOOK_ENCRYPTED_DATA = "encrypted_data" +ATTR_WEBHOOK_ID = "webhook_id" ATTR_WEBHOOK_TYPE = "type" ERR_ENCRYPTION_ALREADY_ENABLED = "encryption_already_enabled" diff --git a/homeassistant/components/mobile_app/notify.py b/homeassistant/components/mobile_app/notify.py index 025880d8107..36afbac71c8 100644 --- a/homeassistant/components/mobile_app/notify.py +++ b/homeassistant/components/mobile_app/notify.py @@ -36,6 +36,7 @@ from .const import ( ATTR_PUSH_RATE_LIMITS_SUCCESSFUL, ATTR_PUSH_TOKEN, ATTR_PUSH_URL, + ATTR_WEBHOOK_ID, DATA_CONFIG_ENTRIES, DATA_NOTIFY, DATA_PUSH_CHANNEL, @@ -147,6 +148,7 @@ class MobileAppNotificationService(BaseNotificationService): reg_info = { ATTR_APP_ID: entry_data[ATTR_APP_ID], ATTR_APP_VERSION: entry_data[ATTR_APP_VERSION], + ATTR_WEBHOOK_ID: target, } if ATTR_OS_VERSION in entry_data: reg_info[ATTR_OS_VERSION] = entry_data[ATTR_OS_VERSION] diff --git a/tests/components/mobile_app/test_notify.py b/tests/components/mobile_app/test_notify.py index c0e1b4c2a85..86cc9f0ae67 100644 --- a/tests/components/mobile_app/test_notify.py +++ b/tests/components/mobile_app/test_notify.py @@ -118,6 +118,7 @@ async def test_notify_works(hass, aioclient_mock, setup_push_receiver): assert call_json["message"] == "Hello world" assert call_json["registration_info"]["app_id"] == "io.homeassistant.mobile_app" assert call_json["registration_info"]["app_version"] == "1.0" + assert call_json["registration_info"]["webhook_id"] == "mock-webhook_id" async def test_notify_ws_works(