diff --git a/homeassistant/loader.py b/homeassistant/loader.py index ae3709e383b..a66a09d7407 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -1789,6 +1789,13 @@ def async_get_issue_tracker( # If we know nothing about the integration, suggest opening an issue on HA core return issue_tracker + if module and not integration_domain: + # If we only have a module, we can try to get the integration domain from it + if module.startswith("custom_components."): + integration_domain = module.split(".")[1] + elif module.startswith("homeassistant.components."): + integration_domain = module.split(".")[2] + if not integration: integration = async_get_issue_integration(hass, integration_domain) diff --git a/tests/test_loader.py b/tests/test_loader.py index 2d5ad76aa8a..c67b520c7dc 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -1143,10 +1143,10 @@ CUSTOM_ISSUE_TRACKER = "https://blablabla.com" ("hue", "homeassistant.components.hue.sensor", CORE_ISSUE_TRACKER_HUE), ("hue", None, CORE_ISSUE_TRACKER_HUE), ("bla_built_in", None, CORE_ISSUE_TRACKER_BUILT_IN), - # Integration domain is not currently deduced from module - (None, "homeassistant.components.hue.sensor", CORE_ISSUE_TRACKER), + (None, "homeassistant.components.hue.sensor", CORE_ISSUE_TRACKER_HUE), ("hue", "homeassistant.components.mqtt.sensor", CORE_ISSUE_TRACKER_HUE), # Loaded custom integration with known issue tracker + (None, "custom_components.bla_custom.sensor", CUSTOM_ISSUE_TRACKER), ("bla_custom", "custom_components.bla_custom.sensor", CUSTOM_ISSUE_TRACKER), ("bla_custom", None, CUSTOM_ISSUE_TRACKER), # Loaded custom integration without known issue tracker @@ -1155,6 +1155,7 @@ CUSTOM_ISSUE_TRACKER = "https://blablabla.com" ("bla_custom_no_tracker", None, None), ("hue", "custom_components.bla.sensor", None), # Unloaded custom integration with known issue tracker + (None, "custom_components.bla_custom_not_loaded.sensor", CUSTOM_ISSUE_TRACKER), ("bla_custom_not_loaded", None, CUSTOM_ISSUE_TRACKER), # Unloaded custom integration without known issue tracker ("bla_custom_not_loaded_no_tracker", None, None), @@ -1218,8 +1219,7 @@ async def test_async_get_issue_tracker( ("hue", "homeassistant.components.hue.sensor", CORE_ISSUE_TRACKER_HUE), ("hue", None, CORE_ISSUE_TRACKER_HUE), ("bla_built_in", None, CORE_ISSUE_TRACKER_BUILT_IN), - # Integration domain is not currently deduced from module - (None, "homeassistant.components.hue.sensor", CORE_ISSUE_TRACKER), + (None, "homeassistant.components.hue.sensor", CORE_ISSUE_TRACKER_HUE), ("hue", "homeassistant.components.mqtt.sensor", CORE_ISSUE_TRACKER_HUE), # Custom integration with known issue tracker - can't find it without hass ("bla_custom", "custom_components.bla_custom.sensor", None),