MQTT tag scanner
The mqtt
tag scanner platform uses an MQTT message payload to generate tag scanned events.
Configuration
MQTT scanners are only supported through MQTT discovery, manual setup through configuration.yaml
is not supported.
The discovery topic needs to be: <discovery_prefix>/tag/[<node_id>/]<object_id>/config
.
Configuration Variables
Information about the device this device trigger is a part of to tie it into the device registry. At least one of identifiers or connections must be present to identify the device.
A link to the webpage that can manage the configuration of this device. Can be either an http://
, https://
or an internal homeassistant://
URL.
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"]]
.
A list of IDs that uniquely identify the device. For example a serial number.
Examples
In this section, you will find some real-life examples of how to use this sensor.
Full configuration with tag ID extracted from JSON data
This is an example of a configuration where the tag ID is extracted from a JSON formatted MQTT message.
To test, you can use the command line tool mosquitto_pub
shipped with mosquitto
or the mosquitto-clients
package to send MQTT messages.
Discover the tag scanner:
mosquitto_pub -h 127.0.0.1 -t homeassistant/tag/0AFFD2/config -m '{"topic": "0AFFD2/tag_scanned", "value_template": "{{ value_json.PN532.UID }}"}'
Generate tag scanned event:
mosquitto_pub -h 127.0.0.1 -t 0AFFD2/tag_scanned -m '{"Time":"2020-09-28T17:02:10","PN532":{"UID":"E9F35959", "DATA":"ILOVETASMOTA"}}'