Log Details (WARNING)
Mon Aug 20 2018 20:57:12 GMT+1200 (New Zealand Standard Time)
Updating ping binary_sensor took longer than the scheduled update interval 0:00:02
I use the ping sensor (interval: 2s count: 2) to monitor of my tv power state. My About page in hass.io error log is full of the error above. Is there a way to exclude this ping error from the error log?
Yes. But note that what you’re seeing is a warning, not an error. This is important because you can exclude things based on their log level. See Logger.
Basically, in your configuration.yaml, for logger:, change the log level for homeassistant.components.binary_sensor.ping to something higher than warning. E.g.:
Updating ping binary_sensor took longer than the scheduled update interval 0:00:02
4:20 PM helpers/entity_platform.py (WARNING)
Updating ping binary_sensor took longer than the scheduled update interval 0:00:02
4:20 PM helpers/entity_platform.py (WARNING)
So I just tried it myself. What I found is the messages don’t go into home-assistant.log anymore, but for some reason they still show up on the Info page in the frontend. I have no idea how this is possible.
I have these warnings for the ping binary_sensor as well. The state doesn’t get updated anymore once these appear and I noticed the Waze sensor gives the same warnings and doesn’t update anymore as well.
I disabled the ping binary_sensor for now to see if that solves the issue with Waze.
I am running HassOS/Hass.io on a Pi 3B+ and currently only have 2 ping binary sensors to detect on/off status of my dumb TV and dumb AV receiver to act as a virtual media player entity. Each sensor is set to refresh every minute, or a one-off update at a set interval following a command to turn on/off the entity. Timeout is left as the default 30s, I reduced count to 1 to try to improve stability, config.yaml is at the bottom of this post.
I wouldn’t have thought this would be over-taxing on the ping binary sensor component but usually within 24hrs following a restart I get the following error:
Updating ping binary_sensor took longer than the scheduled update interval 0:01:00
12:01 PM helpers/entity_platform.py (WARNING) - message first occured at July 29, 2019, 9:59 PM and shows up 830 times
It seems once the sensor fails to update, it then crashes itself completely and can’t be restarted without a reboot. The same problem occurs when using ping as part of a command line binary sensor as below:
Unfortunately beyond the standard error logging I have been unable to find any further details on what is causing the errors and the timeouts but it would appear that the ping function needs modifications to the way it handles errors in-line.
I would be more than happy to try and get more a more in-depth error report if someone can point me in the right direction!
I have tried with NMAP and it works but for one reason or another (possibly to do with my router?) it is very slow to pick up when entities have disconnected from the network - ping works much, much faster, and given I’m using these sensors as a virtual switch I need the better responsiveness.
You can, but as scan_interval and consider_home are global settings then I would have to muck around with, and potentially break, the accuracy of my other device trackers (Google Maps, Bluetooth and BT Smart Hub scanners for presence detection)
EDIT: have tried to migrate everything to NMAP but struggling to get something passable. Ideally I want the sensors to update within 10 seconds so the template switches are responsive - but NMAP can’t seem to deal with a fast scan interval. With ping, I can set it to scan once a minute, but update the entity quickly after HA sends commands to turn the switch on or off. Just a shame it won’t work consistently!
Hoping I don’t jinx it by saying this but I think it’s all fixed now. Tried many, many different ways to fix it but ended up settling with using my wifi device tracking and modifying the consider_home values on a per-device basis to get a good level of response.
For those suffering with lots of ‘took longer than the scheduled update interval’ problems - I eventually swore loudly and committed to a total reinstallation of HA. Immediately ran into issues with my SD card being corrupted - new card in, reinstalled, and now, now problems (I hope).
I can only conclude that these errors were getting caused by either a) a bloated installation requiring a reinstall and refresh OR b) the corrupted blocks on my SD card.
So do consider reinstallation or replacing your SD cards!
I might have foud a workround for this, at least it work for me using hassio on NUC. I ping around 45 systems and I do not have anymore the error messages.
You have to edit the source code, and reduce the ping interval.
If you run hassio, you have to edit the docker overlay. I do not want to go in the detail, but the step are.
1- docker exec -it homeassistant bash
2- edit the file /usr/src/homeassistant/homeassistant/components/ping/binary_sensor.py
3- add the parameter to reduce ping interval, I set mine to 0.2, from a defaul to 1.
For windows based system, you have to edit the other ping command. This may not work on other platform, you have to check if your ping command support the interval parameter like in linux.
This will not survive a hassio update, you have to do it again.
I wonder if this could not be a fix by adding an interval parameter to te ping component.