Skip to content

Commit

Permalink
Await Blueprint Load
Browse files Browse the repository at this point in the history
  • Loading branch information
Sian-Lee-SA committed Jun 5, 2024
1 parent 3d28e77 commit eff56df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/switch_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ async def async_setup_entry( hass, config_entry ):

async def async_migrate( hass, in_dev ):
store = hass.data[DOMAIN][CONF_STORE]

version_update = not store.compare_version( VERSION )
if in_dev or version_update or not await check_blueprints_folder_exists( hass ):
LOGGER.debug('Migrating blueprints')
Expand All @@ -85,7 +86,7 @@ async def async_migrate( hass, in_dev ):
async def _init_blueprints( hass: HomeAssistant ):
# Ensure blueprints empty for clean state
blueprints = hass.data[DOMAIN][CONF_BLUEPRINTS] = {}
for config in load_blueprints(hass):
for config in await load_blueprints(hass):
try:
c_validated = BLUEPRINT_MQTT_SCHEMA(config.get('data')) if config.get('data').get('event_type') == 'mqtt' else BLUEPRINT_EVENT_SCHEMA(config.get('data'))
except vol.Invalid as ex:
Expand Down

0 comments on commit eff56df

Please sign in to comment.