I am trying to develop my first integration and I read this:
So I decided to use async_forward_entry_setups
instead of async_setup_platforms
When I use async_setup_platforms
, the coverage of sensor.py
is 87% (currently missing _handle_coordinator_update
)
But when I change it to async_forward_entry_setups
, the coverage of the same file drops to 63%
This happened because async_setup_entry
isn’t being called.
I know this because I raised a generic exception at the first line of this method definition and didn’t happen anything.
When I keep this exception while calling async_setup_platforms
, a lot of unit tests fail as expected.
So my question is: once I use async_forward_entry_setups
, do I need to change anything else? If so, what else ?
# https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards/
# await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) # new format!
hass.config_entries.async_setup_platforms(entry, PLATFORMS) # old format!