Allow ESPHome to trigger the HA tag scanned event (#40128)

This commit is contained in:
Jesse Hills 2020-09-16 21:54:59 +12:00 committed by GitHub
parent a13c4d4c17
commit d650bcca3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -129,6 +129,16 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
"Can only generate events under esphome domain! (%s)", host
)
return
# Call native tag scan
if service_name == "tag_scanned":
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)
)
return
hass.bus.async_fire(service.service, service_data)
else:
hass.async_create_task(

View file

@ -6,7 +6,5 @@
"requirements": ["aioesphomeapi==2.6.3"],
"zeroconf": ["_esphomelib._tcp.local."],
"codeowners": ["@OttoWinter"],
"after_dependencies": [
"zeroconf"
]
"after_dependencies": ["zeroconf", "tag"]
}