mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Use loader.async_suggest_report_issue in sensor (#101389)
This commit is contained in:
parent
716a10e556
commit
659d437cac
@ -33,6 +33,7 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant, State, split_entity_id
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity import entity_sources
|
||||
from homeassistant.loader import async_suggest_report_issue
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.enum import try_parse_enum
|
||||
|
||||
@ -257,20 +258,10 @@ def _normalize_states(
|
||||
def _suggest_report_issue(hass: HomeAssistant, entity_id: str) -> str:
|
||||
"""Suggest to report an issue."""
|
||||
entity_info = entity_sources(hass).get(entity_id)
|
||||
domain = entity_info["domain"] if entity_info else None
|
||||
custom_component = entity_info["custom_component"] if entity_info else None
|
||||
report_issue = ""
|
||||
if custom_component:
|
||||
report_issue = "report it to the custom integration author."
|
||||
else:
|
||||
report_issue = (
|
||||
"create a bug report at "
|
||||
"https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue"
|
||||
)
|
||||
if domain:
|
||||
report_issue += f"+label%3A%22integration%3A+{domain}%22"
|
||||
|
||||
return report_issue
|
||||
return async_suggest_report_issue(
|
||||
hass, integration_domain=entity_info["domain"] if entity_info else None
|
||||
)
|
||||
|
||||
|
||||
def warn_dip(
|
||||
|
@ -1337,7 +1337,7 @@ def test_compile_hourly_sum_statistics_nan_inf_state(
|
||||
"energy",
|
||||
0,
|
||||
"from integration test ",
|
||||
"report it to the custom integration author",
|
||||
"report it to the author of the 'test' custom integration",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user