esphome / esphome/feature-requests
Support `tag_scanned` over MQTT
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem you have/What new integration you would like**
I use ESPHome for many devices, but I do _not_ use Home Assistant, only MQTT. I would like to use a [tag_scanned](https://esphome.io/components/api.html#homeassistant-tag-scanned-action) action, but that action only works with the Home Assistant API. Though Home Assistant _does_ define [a schema](https://www.home-assistant.io/integrations/tag.mqtt/) for doing it over MQTT. My ideal integration would be to simply have another config option on the [mqtt component](https://esphome.io/components/mqtt) that defines the name of the tag component that's published as the discovery JSON to MQTT, and then the same action would send it to MQTT as well, if the config is defined (and _not_ to the Home Assistant API that is not configured). Still acceptable, but less ideal, would be simply another component called `tag` that simply has an ID, and defines its own action.
**Please describe your use case for this integration and alternatives you've tried:**
I have several NFC keycard readers that I want to send the keycard data that is read to my automation solution (openHAB for me) in order to have a centrally managed database of keycards, instead of doing validation on-device. For now, I'll just use a [text sensor](https://esphome.io/components/text_sensor/), and then blank it out almost immediately. I'd prefer to use a non-retained MQTT topic that the `tag` component implies. I could also use the [mqtt.publish action](https://esphome.io/components/mqtt#mqtt-publish-action), but that means I don't get auto-discovery, and I would either have to manually set up the discovery JSON using another mqtt.publish action on boot (seems like a pain to get the contents correct), or manually configure the receiving end in openHAB, instead of being able to rely on it Just Working because discovery information is available.
**Additional context**
I could probably implement the separate component strategy myself (with only MQTT-backed support, not Home Assistant), but not my preferred solution of re-using the existing action. I'm just not familiar enough with Python, or the ESPHome codebase, with its very limited developer facing documentation.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked tag_scanned action and Home Assistant MQTT tag schema, then read the MQTT component and mqtt.publish action documentation. Done means tag_scanned can publish the documented discovery and event data over MQTT when configured, while preserving existing Home Assistant API behavior and supporting the stated non-retained use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100