Add MQTT service description
This commit is contained in:
parent
1a38354ed5
commit
b1f2c90bd0
2 changed files with 35 additions and 1 deletions
|
@ -12,6 +12,7 @@ import socket
|
|||
import time
|
||||
|
||||
|
||||
from homeassistant.config import load_yaml_config_file
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.util as util
|
||||
from homeassistant.util import template
|
||||
|
@ -166,7 +167,11 @@ def setup(hass, config):
|
|||
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, start_mqtt)
|
||||
|
||||
hass.services.register(DOMAIN, SERVICE_PUBLISH, publish_service)
|
||||
descriptions = load_yaml_config_file(
|
||||
os.path.join(os.path.dirname(__file__), 'services.yaml'))
|
||||
|
||||
hass.services.register(DOMAIN, SERVICE_PUBLISH, publish_service,
|
||||
descriptions.get(SERVICE_PUBLISH))
|
||||
|
||||
return True
|
||||
|
||||
|
|
29
homeassistant/components/mqtt/services.yaml
Normal file
29
homeassistant/components/mqtt/services.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
publish:
|
||||
description: Publish a message to an MQTT topic
|
||||
|
||||
fields:
|
||||
topic:
|
||||
description: Topic to publish payload
|
||||
example: /homeassistant/hello
|
||||
|
||||
payload:
|
||||
description: Payload to publish
|
||||
example: This is great
|
||||
|
||||
payload_template:
|
||||
description: Template to render as payload value. Ignored if payload given.
|
||||
example: "{{ states('sensor.temperature') }}"
|
||||
|
||||
qos:
|
||||
description: Quality of Service
|
||||
example: 2
|
||||
values:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
default: 0
|
||||
|
||||
retain:
|
||||
description: If message should have the retain flag set.
|
||||
example: true
|
||||
default: false
|
Loading…
Add table
Reference in a new issue