-
-
Notifications
You must be signed in to change notification settings - Fork 28.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ESPHome to trigger the HA tag scanned event #40128
Allow ESPHome to trigger the HA tag scanned event #40128
Conversation
Looks good! Converted to draft since we're waiting for upstream. When upstream feature is released, we can go ahead here. |
@MartinHjelmare
|
Ok. |
tag_id = service_data["tag_id"] | ||
device_id = service_data["device_id"] | ||
hass.async_create_task( | ||
hass.components.tag.async_scan_tag(tag_id, device_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
device_id
needs to be the device registry ID of ESPHome device in Home Assistant.
The device registry entry is returned from calling device_registry.async_get_or_create
on line 278. The ID is available as entry.id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature apparently breaks the usage of own custom data entries in the event. Example:I'm trying to send the following event:
What I receive on the event bus is the following:
When I instead use a completely custom event, I lose the
Expected Behaviour:Home Assistant should pass through any additional data it receives on a |
Ah I see, yes this is because the event is not forwarded through, but just calls the HA tag_scan code which itself makes the |
Please discuss this in an issue instead. |
Breaking change
Proposed change
This allows ESPHome node to trigger the tag scanned events by posting a crafted event.
esphome/esphome#1281
esphome/esphome-docs#763
esphome/feature-requests#848
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: