Migrate mqtt services to support translations (#96396)

* Migrate mqtt services to support translations

* Apply suggestions from code review

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
Franck Nijhof 2023-07-12 16:37:59 +02:00 committed by GitHub
parent dc2406ae09
commit d0b7a47768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 22 deletions

View File

@ -1,32 +1,22 @@
# Describes the format for available MQTT services
publish:
name: Publish
description: Publish a message to an MQTT topic.
fields:
topic:
name: Topic
description: Topic to publish payload.
required: true
example: /homeassistant/hello
selector:
text:
payload:
name: Payload
description: Payload to publish.
example: This is great
selector:
text:
payload_template:
name: Payload Template
description: Template to render as payload value. Ignored if payload given.
advanced: true
example: "{{ states('sensor.temperature') }}"
selector:
object:
qos:
name: QoS
description: Quality of Service to use.
advanced: true
default: 0
selector:
@ -36,27 +26,17 @@ publish:
- "1"
- "2"
retain:
name: Retain
description: If message should have the retain flag set.
default: false
selector:
boolean:
dump:
name: Dump
description:
Dump messages on a topic selector to the 'mqtt_dump.txt' file in your
configuration folder.
fields:
topic:
name: Topic
description: topic to listen to
example: "OpenZWave/#"
selector:
text:
duration:
name: Duration
description: how long we should listen for messages in seconds
default: 5
selector:
number:
@ -65,5 +45,3 @@ dump:
unit_of_measurement: "seconds"
reload:
name: Reload
description: Reload all MQTT entities from YAML.

View File

@ -145,5 +145,51 @@
"custom": "Custom"
}
}
},
"services": {
"publish": {
"name": "Publish",
"description": "Publishes a message to an MQTT topic.",
"fields": {
"topic": {
"name": "Topic",
"description": "Topic to publish to."
},
"payload": {
"name": "Payload",
"description": "The payload to publish."
},
"payload_template": {
"name": "Payload template",
"description": "Template to render as a payload value. If a payload is provided, the template is ignored."
},
"qos": {
"name": "QoS",
"description": "Quality of Service to use. O. At most once. 1: At least once. 2: Exactly once."
},
"retain": {
"name": "Retain",
"description": "If the message should have the retain flag set. If set, the broker stores the most recent message on a topic."
}
}
},
"dump": {
"name": "Export",
"description": "Writes all messages on a specific topic into the `mqtt_dump.txt` file in your configuration folder.",
"fields": {
"topic": {
"name": "Topic",
"description": "Topic to listen to."
},
"duration": {
"name": "Duration",
"description": "How long we should listen for messages in seconds."
}
}
},
"reload": {
"name": "Reload",
"description": "Reloads MQTT entities from the YAML-configuration."
}
}
}