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

topic string Required

The MQTT topic subscribed to receive tag scanned events.

value_template string (Optional)

Defines a template that returns a tag ID.

device map Required

Information about the device this device trigger is a part of to tie it into the device registry.

connections list | map (Optional)

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'].

identifiers list | string (Optional)

A list of IDs that uniquely identify the device. For example a serial number.

manufacturer string (Optional)

The manufacturer of the device.

model string (Optional)

The model of the device.

name string (Optional)

The name of the device.

sw_version string (Optional)

The firmware version of the device.

via_device string (Optional)

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.

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 home-assistant/tag/0AFFD2/config -m '{"topic": "tasmota_0AFFD2/tag_scanned", "value_template": ""}'

Generate tag scanned event:

mosquitto_pub -h 127.0.0.1 -t tasmota_0AFFD2/tag_scanned -m '{"Time":"2020-09-28T17:02:10","PN532":{"UID":"E9F35959", "DATA":"ILOVETASMOTA"}}'