Using device_tracker.see

I’m trying to run a device_tracker.see service to trigger an update to a tracked device (using my router). This is just to manually fast track updates rather than waiting for the usual 3 minute timeout (set for other reasons).

What I’m calling is in script:

script:
  livingroom_tv_off:
    alias: Living Room TV Off
    sequence:
      - service: homeassistant.turn_off
        data:
          entity_id:
            - switch.livingroom_tv_power
      - service: device_tracker.see
        data:
          dev_id: device_tracker.livingroom_tv
          location_name: 'not_home'

Neither services run and I get the following in the logs:

2017-07-02 23:17:04 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/core.py”, line 1023, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 207, in async_see_service
yield from tracker.async_see(**args)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 272, in async_see
dev_id = cv.slug(str(dev_id).lower())
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/config_validation.py”, line 236, in slug
raise vol.Invalid(‘invalid slug {} (try {})’.format(value, slg))
voluptuous.error.Invalid: invalid slug device_tracker.livingroom_tv (try device_trackerlivingroom_tv)

Can anyone see what I’m doing wrong?

1 Like

Yes, you should be using just the device ID not the entity name, e.g. livingroom_tv instead of device_tracker.livingroom_tv

3 Likes