File tree Expand file tree Collapse file tree
custom_components/bms_ble Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,7 +115,10 @@ async def async_step_bluetooth_confirm(
115115 LOGGER .debug ("confirm step for %s" , self ._disc_dev .name )
116116
117117 if user_input is not None :
118+ # Re-set unique_id to avoid race with newly added entries
119+ await self .async_set_unique_id (self ._disc_dev .discovery_info .address )
118120 self ._abort_if_unique_id_configured ()
121+
119122 return self .async_create_entry (
120123 title = self ._disc_dev .name ,
121124 data = {"type" : self ._disc_dev .type },
Original file line number Diff line number Diff line change @@ -278,6 +278,7 @@ async def test_bluetooth_confirm_entry_added_during_flow(
278278 # Simulate another flow/user creating the entry before confirmation
279279 cfg : MockConfigEntry = mock_config ()
280280 cfg .add_to_hass (hass )
281+ await hass .config_entries .async_setup (cfg .entry_id )
281282 await hass .async_block_till_done ()
282283
283284 # Now try to confirm - should abort instead of creating entry
You can’t perform that action at this time.
0 commit comments