Mobile App integration to use tag integration (#38757)

pull/38760/head
Paulus Schoutsen 2020-08-11 14:23:47 +02:00 committed by GitHub
parent 1d9a469f84
commit d1780b8d7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/mobile_app",
"requirements": ["PyNaCl==1.3.0", "emoji==0.5.4"],
"dependencies": ["http", "webhook", "person"],
"dependencies": ["http", "webhook", "person", "tag"],
"after_dependencies": ["cloud", "camera"],
"codeowners": ["@robbiet480"],
"quality_scale": "internal"

View File

@ -8,6 +8,7 @@ from aiohttp.web import HTTPBadRequest, Request, Response, json_response
from nacl.secret import SecretBox
import voluptuous as vol
from homeassistant.components import tag
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES as BINARY_SENSOR_CLASSES,
)
@ -544,9 +545,10 @@ async def webhook_get_config(hass, config_entry, data):
@validate_schema({vol.Required("tag_id"): cv.string})
async def webhook_scan_tag(hass, config_entry, data):
"""Handle a fire event webhook."""
hass.bus.async_fire(
"tag_scanned",
{"tag_id": data["tag_id"], "device_id": config_entry.data[ATTR_DEVICE_ID]},
context=registration_context(config_entry.data),
await tag.async_scan_tag(
hass,
data["tag_id"],
config_entry.data[ATTR_DEVICE_ID],
registration_context(config_entry.data),
)
return empty_okay_response()