Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device_tracker and/or Sensor changing states randomly since 0.115.x #40577

Closed
apedance opened this issue Sep 25, 2020 · 15 comments
Closed

Device_tracker and/or Sensor changing states randomly since 0.115.x #40577

apedance opened this issue Sep 25, 2020 · 15 comments

Comments

@apedance
Copy link

apedance commented Sep 25, 2020

The problem

Device Tracker switching states randomly.
Using the nmap component and the ping component.

image
Most of these devices should be online.

image
Yet they change randomly.

I can rule out a network issue since all pings from the debian 10 host system went through without a packet loss.

Environment

  • Home Assistant Core release with the issue: 0.115.2
  • Last working Home Assistant Core release (if known): 0.114.x
  • Operating environment (OS/Container/Supervised/Core): Supervised
  • Integration causing this issue: nmap, ping, devicetracker, sensor

Problem-relevant configuration.yaml

  - platform: nmap_tracker
    #consider_home: 1200
    home_interval: 10
    hosts:
    - 192.168.1.1
    - 192.168.1.2
    - 192.168.1.3

or

  - platform: ping
    hosts:
      device1: 192.168.1.1
      device2: 192.168.1.2
      count: 3
      scan_interval: 120

most of the device_trackers are then translated to sensors like following

      device1:
        value_template: "{% if is_state('device_tracker.device1', 'home') %}online{% else %}off{% endif %}" 

Traceback/Error logs

Logger: homeassistant.components.device_tracker
Source: components/device_tracker/setup.py:152
Integration: Device tracker (documentation, issues)
First occurred: September 24, 2020, 11:52:37 PM (2334 occurrences)
Last logged: 12:37:23 PM

Updating device list from legacy took longer than the scheduled scan interval 0:00:12

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:576
Integration: Binary sensor (documentation, issues)
First occurred: September 24, 2020, 11:31:51 PM (10 occurrences)
Last logged: 11:42:55 AM

Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
[homeassistant.bootstrap] Waiting on integrations to complete setup: device_tracker # this is on boot

#this is during 
2020-09-26 11:36:18 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12
2020-09-26 11:36:30 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12
2020-09-26 11:36:42 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12
2020-09-26 11:36:54 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12
2020-09-26 11:37:06 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12
2020-09-26 11:37:18 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12

This stalls the whole system startup into like 3 minutes hanging until this goes away.

Additional information

@probot-home-assistant
Copy link

nmap_tracker documentation
nmap_tracker source
(message by IssueLinks)

@probot-home-assistant
Copy link

ping documentation
ping source
(message by IssueLinks)

@apedance
Copy link
Author

apedance commented Sep 26, 2020

After like a few hours of uptime, the following message is spammed every few seconds.

WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12

I tried to check if the problem persists if I change alle my presence detection to either nmap or ping.
Happens to both of them. After set period of time the states just go haywire.

@SaturnusDJ
Copy link

Something strange is happening here as well since 0.115.4 (coming from 0.114.3).
"Waiting on integrations to complete setup: device_tracker"
No changes there, and no related breaking changes found. Yet the device tracker entries are switching between home and away every ~3-6 minutes.

@SaturnusDJ
Copy link

SaturnusDJ commented Sep 30, 2020

2020-09-30 11:13:11 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: device_tracker
2020-09-30 11:14:11 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: device_tracker
2020-09-30 11:14:52 WARNING (SyncWorker_12) [zeroconf] Error sending through socket 12
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2889, in send
    bytes_sent = s.sendto(packet, 0, (real_addr, port))
OSError: [Errno 126] No error information

Right after that last one HA 'is started' (with minutes of delay).

Edit2: Nah, indeed, both ping and nmap are broken.

@apedance
Copy link
Author

apedance commented Sep 30, 2020

Indeed. Maybe this clue can shed some light on this issue:

mudape/iphonedetect#40

This very good custom component is working fine for me right now. No issues at all. I migrated all my device tracking to this custom component.
I think this component is using very similar methods to check for device availability.
For the users having issues right now this might be a solution until the other trackers get fixed.

@SaturnusDJ
Copy link

SaturnusDJ commented Oct 9, 2020

@apedance
Hey, have you tried 0.116?
I am always delaying the updates with ~2 weeks because of these kind of bugs we are having now.

Had a look through the commits from 0.115.2 to the latest 0.114...
Maybe something went wrong in one of these:
b4d2965
7b01606
1720b71
11e4ad2
e649e27
57848cd

@gotschi
Copy link

gotschi commented Oct 10, 2020

same issue, nmap works at first but fails after some time
luci always works but reports devices offline randomly and constantly

@apedance
Copy link
Author

@SaturnusDJ
Hello!
I will give it a try.
I moved all my device tracking to the iphonedetect component which is working fine. (https://github.com/mudape/iphonedetect)

@SaturnusDJ
Copy link

SaturnusDJ commented Nov 30, 2020

Still in 0.116 and 0.117 for at least ping. Maybe nmap_tracker is working again.

WARNING (zeroconf-ServiceBrowser__plugwise._tcp.local.-_ssh._tcp.local.-_miio._udp.local.-_viziocast._tcp.local.-_http._tcp.local.-_esphomelib._tcp.local.-_googlecast._tcp.local.-_ipp._tcp.local.-_homekit._tcp.local.-_bond._tcp.local.-_hap._tcp.local.-_elg._tcp.local.-_daap._tcp.local.-_ipps._tcp.local.-_spotify-connect._tcp.local.-_api._udp.local.-_nut._tcp.local.-_Volumio._tcp.local.-_printer._tcp.local.-_dkapi._tcp.local.-_xbmc-jsonrpc-h._tcp.local.-_wled._tcp.local.-_axis-video._tcp.local._311) [zeroconf] Error sending through socket 10


Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2914, in send
    bytes_sent = s.sendto(packet, 0, (real_addr, port))
OSError: [Errno 126] No error information

Do we maybe use a specific component/integration that clashes?

No change with following disabled:

  • Xiaomi Aqara Gateway
  • zigbee2mqtt_networkmap
  • homekit
  • nefiteasy
  • wake_on_lan
  • mqtt
  • weather

Not tested: influxdb

Was does look odd is when it is starting up, the ping entities take a long time to be available as if it is pinging one device per second or slower. After that is done, all other device_tracker entities become available immediately.

@SaturnusDJ
Copy link

SaturnusDJ commented Feb 24, 2021

Same for 2021.2.3.
That custom component did not do the job for me.

Should we mention someone higher up?

Wait wait...the error still shows but ping might actually work. I am testing atm.

Okay, despite the error, it looks the issue is not happening anymore 🥂

@SaturnusDJ
Copy link

SaturnusDJ commented Mar 26, 2021

Although it works...HA has slow startup time because of it. A strange result is that it takes minutes for light groups to be started. 🤦‍♂️

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 24, 2021
@SaturnusDJ
Copy link

@github-actions github-actions bot removed the stale label Jun 25, 2021
@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants