mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
add link ability to configurator (#2035)
This commit is contained in:
parent
0340710e5c
commit
3ed6be5b4e
@ -19,6 +19,8 @@ SERVICE_CONFIGURE = "configure"
|
|||||||
STATE_CONFIGURE = "configure"
|
STATE_CONFIGURE = "configure"
|
||||||
STATE_CONFIGURED = "configured"
|
STATE_CONFIGURED = "configured"
|
||||||
|
|
||||||
|
ATTR_LINK_NAME = "link_name"
|
||||||
|
ATTR_LINK_URL = "link_url"
|
||||||
ATTR_CONFIGURE_ID = "configure_id"
|
ATTR_CONFIGURE_ID = "configure_id"
|
||||||
ATTR_DESCRIPTION = "description"
|
ATTR_DESCRIPTION = "description"
|
||||||
ATTR_DESCRIPTION_IMAGE = "description_image"
|
ATTR_DESCRIPTION_IMAGE = "description_image"
|
||||||
@ -34,7 +36,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
def request_config(
|
def request_config(
|
||||||
hass, name, callback, description=None, description_image=None,
|
hass, name, callback, description=None, description_image=None,
|
||||||
submit_caption=None, fields=None):
|
submit_caption=None, fields=None, link_name=None, link_url=None):
|
||||||
"""Create a new request for configuration.
|
"""Create a new request for configuration.
|
||||||
|
|
||||||
Will return an ID to be used for sequent calls.
|
Will return an ID to be used for sequent calls.
|
||||||
@ -43,7 +45,8 @@ def request_config(
|
|||||||
|
|
||||||
request_id = instance.request_config(
|
request_id = instance.request_config(
|
||||||
name, callback,
|
name, callback,
|
||||||
description, description_image, submit_caption, fields)
|
description, description_image, submit_caption,
|
||||||
|
fields, link_name, link_url)
|
||||||
|
|
||||||
_REQUESTS[request_id] = instance
|
_REQUESTS[request_id] = instance
|
||||||
|
|
||||||
@ -100,7 +103,8 @@ class Configurator(object):
|
|||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
def request_config(
|
def request_config(
|
||||||
self, name, callback,
|
self, name, callback,
|
||||||
description, description_image, submit_caption, fields):
|
description, description_image, submit_caption,
|
||||||
|
fields, link_name, link_url):
|
||||||
"""Setup a request for configuration."""
|
"""Setup a request for configuration."""
|
||||||
entity_id = generate_entity_id(ENTITY_ID_FORMAT, name, hass=self.hass)
|
entity_id = generate_entity_id(ENTITY_ID_FORMAT, name, hass=self.hass)
|
||||||
|
|
||||||
@ -121,6 +125,8 @@ class Configurator(object):
|
|||||||
(ATTR_DESCRIPTION, description),
|
(ATTR_DESCRIPTION, description),
|
||||||
(ATTR_DESCRIPTION_IMAGE, description_image),
|
(ATTR_DESCRIPTION_IMAGE, description_image),
|
||||||
(ATTR_SUBMIT_CAPTION, submit_caption),
|
(ATTR_SUBMIT_CAPTION, submit_caption),
|
||||||
|
(ATTR_LINK_NAME, link_name),
|
||||||
|
(ATTR_LINK_URL, link_url),
|
||||||
] if value is not None
|
] if value is not None
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user