mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Use device name for device_tracker entry (#24155)
This commit is contained in:
parent
1b543cf538
commit
d9c78b77cb
@ -24,6 +24,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_send
|
|||||||
from homeassistant.helpers.template import attach
|
from homeassistant.helpers.template import attach
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
from .const import (ATTR_ALTITUDE, ATTR_BATTERY, ATTR_COURSE, ATTR_DEVICE_ID,
|
from .const import (ATTR_ALTITUDE, ATTR_BATTERY, ATTR_COURSE, ATTR_DEVICE_ID,
|
||||||
ATTR_DEVICE_NAME, ATTR_EVENT_DATA, ATTR_EVENT_TYPE,
|
ATTR_DEVICE_NAME, ATTR_EVENT_DATA, ATTR_EVENT_TYPE,
|
||||||
ATTR_GPS, ATTR_GPS_ACCURACY, ATTR_LOCATION_NAME,
|
ATTR_GPS, ATTR_GPS_ACCURACY, ATTR_LOCATION_NAME,
|
||||||
@ -150,7 +152,7 @@ async def handle_webhook(hass: HomeAssistantType, webhook_id: str,
|
|||||||
|
|
||||||
if webhook_type == WEBHOOK_TYPE_UPDATE_LOCATION:
|
if webhook_type == WEBHOOK_TYPE_UPDATE_LOCATION:
|
||||||
see_payload = {
|
see_payload = {
|
||||||
ATTR_DEV_ID: registration[ATTR_DEVICE_ID],
|
ATTR_DEV_ID: slugify(registration[ATTR_DEVICE_NAME]),
|
||||||
ATTR_GPS: data[ATTR_GPS],
|
ATTR_GPS: data[ATTR_GPS],
|
||||||
ATTR_GPS_ACCURACY: data[ATTR_GPS_ACCURACY],
|
ATTR_GPS_ACCURACY: data[ATTR_GPS_ACCURACY],
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user