File tree Expand file tree Collapse file tree
custom_components/victron_mqtt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,16 +96,21 @@ async def async_setup_entry(
9696 hub = Hub (hass , entry )
9797 entry .runtime_data = hub
9898
99+ await hass .config_entries .async_forward_entry_setups (entry , PLATFORMS )
100+ # All platforms should be set up before starting the hub
101+ try :
102+ await hub .start ()
103+ except Exception as exc :
104+ _LOGGER .error ("hub.start() failed for entry %s: %s" , entry .entry_id , exc , exc_info = True )
105+ # Clean up partial setup to avoid double setup issues
106+ await async_unload_entry (hass , entry )
107+ raise
108+
99109 # Register the update listener
100110 entry .async_on_unload (entry .add_update_listener (_update_listener ))
101111
102- await hass .config_entries .async_forward_entry_setups (entry , PLATFORMS )
103- # All platforms should be set up before starting the hub
104- await hub .start ()
105-
106112 # Register services
107113 await async_setup_services (hass , entry )
108-
109114 _LOGGER .info ("async_setup_entry completed for entry: %s" , entry .entry_id )
110115 return True
111116
You can’t perform that action at this time.
0 commit comments