Persistent_notification service description (#2407)

* Persistent_notification service description

* Add service name to services.yaml
pull/2436/head
Johann Kellerman 2016-07-04 03:33:23 +02:00 committed by Paulus Schoutsen
parent 659d67f362
commit 2cdef7fb2f
2 changed files with 22 additions and 1 deletions

View File

@ -4,6 +4,7 @@ A component which is collecting configuration errors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/persistent_notification/
"""
import os
import logging
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.entity import generate_entity_id
from homeassistant.util import slugify
from homeassistant.config import load_yaml_config_file
DOMAIN = 'persistent_notification'
ENTITY_ID_FORMAT = DOMAIN + '.{}'
@ -74,7 +76,10 @@ def setup(hass, config):
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)
return True

View 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