Add device mapping and json_attributes options for mqtt scene (#28275)

This commit is contained in:
Jan Bouwhuis 2023-07-22 18:00:48 +02:00 committed by GitHub
parent 0af6d30daf
commit cff9beab59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,51 @@ command_topic:
description: The MQTT topic to publish `payload_on` to activate the scene.
required: false
type: string
device:
description: "Information about the device this scene is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html). Only works when [`unique_id`](#unique_id) is set. At least one of identifiers or connections must be present to identify the device."
required: false
type: map
keys:
configuration_url:
description: 'A link to the webpage that can manage the configuration of this device. Can be either an HTTP or HTTPS link.'
required: false
type: string
connections:
description: 'A list of connections of the device to the outside world as a list of tuples `[connection_type, connection_identifier]`. For example the MAC address of a network interface: `"connections": [["mac", "02:5b:26:a8:dc:12"]]`.'
required: false
type: list
hw_version:
description: The hardware version of the device.
required: false
type: string
identifiers:
description: A list of IDs that uniquely identify the device. For example a serial number.
required: false
type: [string, list]
manufacturer:
description: The manufacturer of the device.
required: false
type: string
model:
description: The model of the device.
required: false
type: string
name:
description: The name of the device.
required: false
type: string
suggested_area:
description: 'Suggest an area if the device isnt in one yet.'
required: false
type: string
sw_version:
description: The firmware version of the device.
required: false
type: string
via_device:
description: 'Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.'
required: false
type: string
enabled_by_default:
description: Flag which defines if the entity should be enabled when first added.
required: false
@ -74,10 +119,23 @@ entity_category:
required: false
type: string
default: None
encoding:
description: The encoding of the published messages.
required: false
type: string
default: "utf-8"
icon:
description: Icon for the scene.
required: false
type: icon
json_attributes_template:
description: "Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/integrations/sensor.mqtt/#json-attributes-template-configuration) documentation."
required: false
type: template
json_attributes_topic:
description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/integrations/sensor.mqtt/#json-attributes-topic-configuration) documentation.
required: false
type: string
name:
description: The name to use when displaying this scene.
required: false
@ -137,13 +195,16 @@ The example below shows a full configuration for a scene.
mqtt:
- scene:
unique_id: living_room_party_scene
name: "Living Room Party Scene"
name: "Party Scene"
command_topic: "home/living_room/party_scene/set"
availability:
- topic: "home/living_room/party_scene/available"
payload_on: "ON"
qos: 0
retain: true
device:
name: "Living Room"
identifiers: "livingroom_lights"
```
### Use with a JSON Payload