mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
allow ios device tracker see calls to go through (#13020)
This commit is contained in:
parent
ca973b68e0
commit
34c694c20e
@ -111,6 +111,9 @@ SERVICE_SEE_PAYLOAD_SCHEMA = vol.Schema(vol.All(
|
|||||||
ATTR_ATTRIBUTES: dict,
|
ATTR_ATTRIBUTES: dict,
|
||||||
ATTR_SOURCE_TYPE: vol.In(SOURCE_TYPES),
|
ATTR_SOURCE_TYPE: vol.In(SOURCE_TYPES),
|
||||||
ATTR_CONSIDER_HOME: cv.time_period,
|
ATTR_CONSIDER_HOME: cv.time_period,
|
||||||
|
# Temp workaround for iOS app introduced in 0.65
|
||||||
|
vol.Optional('battery_status'): str,
|
||||||
|
vol.Optional('hostname'): str,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
@ -219,7 +222,11 @@ def async_setup(hass: HomeAssistantType, config: ConfigType):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_see_service(call):
|
def async_see_service(call):
|
||||||
"""Service to see a device."""
|
"""Service to see a device."""
|
||||||
yield from tracker.async_see(**call.data)
|
# Temp workaround for iOS, introduced in 0.65
|
||||||
|
data = dict(call.data)
|
||||||
|
data.pop('hostname', None)
|
||||||
|
data.pop('battery_status', None)
|
||||||
|
yield from tracker.async_see(**data)
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
DOMAIN, SERVICE_SEE, async_see_service, SERVICE_SEE_PAYLOAD_SCHEMA)
|
DOMAIN, SERVICE_SEE, async_see_service, SERVICE_SEE_PAYLOAD_SCHEMA)
|
||||||
|
@ -730,3 +730,18 @@ async def test_old_style_track_new_is_skipped(mock_device_tracker_conf, hass):
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_device_tracker_conf) == 1
|
assert len(mock_device_tracker_conf) == 1
|
||||||
assert mock_device_tracker_conf[0].track is False
|
assert mock_device_tracker_conf[0].track is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_see_schema_allowing_ios_calls():
|
||||||
|
"""Test SEE service schema allows extra keys.
|
||||||
|
|
||||||
|
Temp work around because the iOS app sends incorrect data.
|
||||||
|
"""
|
||||||
|
device_tracker.SERVICE_SEE_PAYLOAD_SCHEMA({
|
||||||
|
'dev_id': 'Test',
|
||||||
|
"battery": 35,
|
||||||
|
"battery_status": 'Unplugged',
|
||||||
|
"gps": [10.0, 10.0],
|
||||||
|
"gps_accuracy": 300,
|
||||||
|
"hostname": 'beer',
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user