mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Persistent_notification service description (#2407)
* Persistent_notification service description * Add service name to services.yaml
This commit is contained in:
parent
659d67f362
commit
2cdef7fb2f
@ -4,6 +4,7 @@ A component which is collecting configuration errors.
|
|||||||
For more details about this component, please refer to the documentation at
|
For more details about this component, please refer to the documentation at
|
||||||
https://home-assistant.io/components/persistent_notification/
|
https://home-assistant.io/components/persistent_notification/
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -12,6 +13,7 @@ from homeassistant.exceptions import TemplateError
|
|||||||
from homeassistant.helpers import template, config_validation as cv
|
from homeassistant.helpers import template, config_validation as cv
|
||||||
from homeassistant.helpers.entity import generate_entity_id
|
from homeassistant.helpers.entity import generate_entity_id
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
from homeassistant.config import load_yaml_config_file
|
||||||
|
|
||||||
DOMAIN = 'persistent_notification'
|
DOMAIN = 'persistent_notification'
|
||||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||||
@ -74,7 +76,10 @@ def setup(hass, config):
|
|||||||
|
|
||||||
hass.states.set(entity_id, message, attr)
|
hass.states.set(entity_id, message, attr)
|
||||||
|
|
||||||
hass.services.register(DOMAIN, SERVICE_CREATE, create_service, {},
|
descriptions = load_yaml_config_file(
|
||||||
|
os.path.join(os.path.dirname(__file__), 'services.yaml'))
|
||||||
|
hass.services.register(DOMAIN, SERVICE_CREATE, create_service,
|
||||||
|
descriptions[DOMAIN][SERVICE_CREATE],
|
||||||
SCHEMA_SERVICE_CREATE)
|
SCHEMA_SERVICE_CREATE)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
16
homeassistant/components/services.yaml
Normal file
16
homeassistant/components/services.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
persistent_notification:
|
||||||
|
create:
|
||||||
|
description: Show a notification in the frontend
|
||||||
|
|
||||||
|
fields:
|
||||||
|
message:
|
||||||
|
description: Message body of the notification. [Templates accepted]
|
||||||
|
example: Please check your configuration.yaml.
|
||||||
|
|
||||||
|
title:
|
||||||
|
description: Optional title for your notification. [Optional, Templates accepted]
|
||||||
|
example: Test notification
|
||||||
|
|
||||||
|
notification_id:
|
||||||
|
description: Target ID of the notification, will replace a notification with the same Id. [Optional]
|
||||||
|
example: 1234
|
Loading…
x
Reference in New Issue
Block a user