I/O should be moved outside the event loop
HomeAssistant 0.109 added detection of blocking I/O in the event loop and has identified this plugin as non-compliant.
Expected Behavior
HomeAssistant should not emit any warnings during the plugin's execution.
Current Behavior
The following warning is emitted to the log approximately every 30 seconds.
WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for hildebrandglow doing I/O at custom_components/hildebrandglow/glow.py, line 53: response = requests.get(url, headers=headers)
Possible Solution
Wrapping the calls to the Glowmarkt bindings in hass.async_add_executor_job might help by moving the blocking call off the event thread.
Steps to Reproduce
- Set up the plugin
- Verify energy readings are being picked up
- Check the HomeAssistant server log