Device Tracker firing all the time

I’m using both the dd-wrt and bluetooth device trackers in HassIO. Recently, my presence detection is starting to do some very strange things.

Home assistant keeps logging presence changes, from home to not_home, then back to home, on a repeated basis, for all of my devices that are actually continually home. This is causing all sorts of havoc with my automations, making my lights flick off then back on, starting and stopping my music, and so on.

It’s also disconnecting and reconnecting to my Google Play Music desktop player intermittently, so I’m not able to control things consistently. (I’m also not able to resolve this problem with Plex certificates, but the Plex component appears to be working properly).

This only started happening after I reformatted my main PC yesterday. HassIO is running on its own RasPi3, which I haven’t touched.

Here’s the log from Home Assistant.

2017-10-30 11:22:04 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2017-10-30 11:22:05 WARNING (MainThread) [homeassistant.setup] Setup of media_player is taking over 10 seconds.
2017-10-30 11:22:06 WARNING (MainThread) [homeassistant.setup] Setup of device_tracker is taking over 10 seconds.
2017-10-30 11:22:08 WARNING (MainThread) [homeassistant.setup] Setup of tts is taking over 10 seconds.
2017-10-30 11:22:10 ERROR (Thread-3) [requests.packages.urllib3.connection] Certificate did not match expected hostname: 192-168-1-10.3aa75d18e3094f5fb034fd55ab3f1ae1.plex.direct. Certificate: {'subject': ((('countryName', 'US'),), (('stateOrProvinceName', 'CA'),), (('localityName', 'Los Gatos'),), (('organizationName', 'Plex, Inc.'),), (('commonName', '*.ef117a69fbf74c94b8b8797349468a1b.plex.direct'),)), 'issuer': ((('countryName', 'US'),), (('organizationName', 'Plex, Inc.'),), (('commonName', 'Plex Devices High Assurance CA2'),)), 'version': 3, 'serialNumber': '066D779C4B326117F5C00B7816AE9647', 'notBefore': 'Oct 25 00:00:00 2017 GMT', 'notAfter': 'Oct 25 12:00:00 2018 GMT', 'subjectAltName': (('DNS', '*.ef117a69fbf74c94b8b8797349468a1b.plex.direct'),), 'OCSP': ('http://ocspx.digicert.com',), 'caIssuers': ('http://cacerts.digicert.com/PlexDevicesHighAssuranceCA2.crt',)}
2017-10-30 11:22:10 ERROR (Thread-3) [plexapi] https://192-168-1-10.3aa75d18e3094f5fb034fd55ab3f1ae1.plex.direct:32400: hostname '192-168-1-10.3aa75d18e3094f5fb034fd55ab3f1ae1.plex.direct' doesn't match '*.ef117a69fbf74c94b8b8797349468a1b.plex.direct'
2017-10-30 11:22:10 ERROR (Thread-4) [requests.packages.urllib3.connection] Certificate did not match expected hostname: 74-57-116-138.3aa75d18e3094f5fb034fd55ab3f1ae1.plex.direct. Certificate: {'subject': ((('countryName', 'US'),), (('stateOrProvinceName', 'CA'),), (('localityName', 'Los Gatos'),), (('organizationName', 'Plex, Inc.'),), (('commonName', '*.ef117a69fbf74c94b8b8797349468a1b.plex.direct'),)), 'issuer': ((('countryName', 'US'),), (('organizationName', 'Plex, Inc.'),), (('commonName', 'Plex Devices High Assurance CA2'),)), 'version': 3, 'serialNumber': '066D779C4B326117F5C00B7816AE9647', 'notBefore': 'Oct 25 00:00:00 2017 GMT', 'notAfter': 'Oct 25 12:00:00 2018 GMT', 'subjectAltName': (('DNS', '*.ef117a69fbf74c94b8b8797349468a1b.plex.direct'),), 'OCSP': ('http://ocspx.digicert.com',), 'caIssuers': ('http://cacerts.digicert.com/PlexDevicesHighAssuranceCA2.crt',)}
2017-10-30 11:22:10 ERROR (Thread-4) [plexapi] https://74-57-116-138.3aa75d18e3094f5fb034fd55ab3f1ae1.plex.direct:25833: hostname '74-57-116-138.3aa75d18e3094f5fb034fd55ab3f1ae1.plex.direct' doesn't match '*.ef117a69fbf74c94b8b8797349468a1b.plex.direct'
2017-10-30 11:22:13 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform plex
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 170, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/plex.py", line 80, in setup_platform
    file_config = config_from_file(hass.config.path(PLEX_CONFIG_FILE))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/plex.py", line 68, in config_from_file
    return json.loads(fdesc.read())
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 34 (char 33)
2017-10-30 11:22:50 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.gpm_desktop_player fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 309, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/gpmdp.py", line 236, in update
    self._status = PLAYBACK_DICT[str(playstate['value'])]
KeyError: 'value'
2017-10-30 11:22:58 WARNING (SyncWorker_14) [netdisco.ssdp] Found malformed XML at http://192.168.1.14:80/description.xml: 
2017-10-30 11:23:05 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform plex
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 170, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/plex.py", line 80, in setup_platform
    file_config = config_from_file(hass.config.path(PLEX_CONFIG_FILE))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/plex.py", line 68, in config_from_file
    return json.loads(fdesc.read())
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 34 (char 33)
2017-10-30 11:23:13 WARNING (MainThread) [homeassistant.components.media_player] Setup of platform cast is taking over 10 seconds.

It turns out that having both bluetooth and dd-wrt tracking on at the same time is causing this issue. Still not sure why, though. For now, I’ve disabled bluetooth tracking, but I’d really like to have it enabled, as I’m using a couple of wireless access points across my apartment, and when I spend too much time away from my main router, HA thinks I’m not home.