mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 04:05:20 +01:00
Get the polling state of a sensor from a template (#159900)
This commit is contained in:
@@ -1208,7 +1208,14 @@ def config_entry_attr(
|
|||||||
if not isinstance(config_entry_id_, str):
|
if not isinstance(config_entry_id_, str):
|
||||||
raise TemplateError("Must provide a config entry ID")
|
raise TemplateError("Must provide a config entry ID")
|
||||||
|
|
||||||
if attr_name not in ("domain", "title", "state", "source", "disabled_by"):
|
if attr_name not in (
|
||||||
|
"domain",
|
||||||
|
"title",
|
||||||
|
"state",
|
||||||
|
"source",
|
||||||
|
"disabled_by",
|
||||||
|
"pref_disable_polling",
|
||||||
|
):
|
||||||
raise TemplateError("Invalid config entry attribute")
|
raise TemplateError("Invalid config entry attribute")
|
||||||
|
|
||||||
config_entry = hass.config_entries.async_get_entry(config_entry_id_)
|
config_entry = hass.config_entries.async_get_entry(config_entry_id_)
|
||||||
|
|||||||
@@ -1721,6 +1721,7 @@ async def test_config_entry_attr(hass: HomeAssistant) -> None:
|
|||||||
"title": "mock title",
|
"title": "mock title",
|
||||||
"source": config_entries.SOURCE_BLUETOOTH,
|
"source": config_entries.SOURCE_BLUETOOTH,
|
||||||
"disabled_by": config_entries.ConfigEntryDisabler.USER,
|
"disabled_by": config_entries.ConfigEntryDisabler.USER,
|
||||||
|
"pref_disable_polling": True,
|
||||||
}
|
}
|
||||||
config_entry = MockConfigEntry(**info)
|
config_entry = MockConfigEntry(**info)
|
||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
|
|||||||
Reference in New Issue
Block a user