diff --git a/homeassistant/components/microbees/manifest.json b/homeassistant/components/microbees/manifest.json index be28bf881d2dc9..c31f274a18f78f 100644 --- a/homeassistant/components/microbees/manifest.json +++ b/homeassistant/components/microbees/manifest.json @@ -5,6 +5,7 @@ "config_flow": true, "dependencies": ["application_credentials"], "documentation": "https://www.home-assistant.io/integrations/microbees", + "integration_type": "hub", "iot_class": "cloud_polling", "requirements": ["microBeesPy==0.3.5"] } diff --git a/homeassistant/components/mikrotik/manifest.json b/homeassistant/components/mikrotik/manifest.json index 6442ba1c3a1f64..480056851d5897 100644 --- a/homeassistant/components/mikrotik/manifest.json +++ b/homeassistant/components/mikrotik/manifest.json @@ -4,6 +4,7 @@ "codeowners": ["@engrbm87"], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/mikrotik", + "integration_type": "device", "iot_class": "local_polling", "loggers": ["librouteros"], "requirements": ["librouteros==3.2.0"] diff --git a/homeassistant/components/moat/manifest.json b/homeassistant/components/moat/manifest.json index d23c6b11969b1c..d026d827e2fde9 100644 --- a/homeassistant/components/moat/manifest.json +++ b/homeassistant/components/moat/manifest.json @@ -11,6 +11,7 @@ "config_flow": true, "dependencies": ["bluetooth_adapters"], "documentation": "https://www.home-assistant.io/integrations/moat", + "integration_type": "device", "iot_class": "local_push", "requirements": ["moat-ble==0.1.1"] } diff --git a/homeassistant/components/moehlenhoff_alpha2/manifest.json b/homeassistant/components/moehlenhoff_alpha2/manifest.json index 45b7f8c956599f..0979077625f42c 100644 --- a/homeassistant/components/moehlenhoff_alpha2/manifest.json +++ b/homeassistant/components/moehlenhoff_alpha2/manifest.json @@ -4,6 +4,7 @@ "codeowners": ["@j-a-n"], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/moehlenhoff_alpha2", + "integration_type": "hub", "iot_class": "local_push", "requirements": ["moehlenhoff-alpha2==1.4.0"] } diff --git a/homeassistant/components/monarch_money/manifest.json b/homeassistant/components/monarch_money/manifest.json index d45415bbcd790a..f7f5716cfad9e9 100644 --- a/homeassistant/components/monarch_money/manifest.json +++ b/homeassistant/components/monarch_money/manifest.json @@ -4,6 +4,7 @@ "codeowners": ["@jeeftor"], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/monarchmoney", + "integration_type": "service", "iot_class": "cloud_polling", "requirements": ["typedmonarchmoney==0.4.4"] } diff --git a/homeassistant/components/monoprice/manifest.json b/homeassistant/components/monoprice/manifest.json index 398c8c48bb59cb..e8f4732946a100 100644 --- a/homeassistant/components/monoprice/manifest.json +++ b/homeassistant/components/monoprice/manifest.json @@ -4,6 +4,7 @@ "codeowners": ["@etsinko", "@OnFreund"], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/monoprice", + "integration_type": "hub", "iot_class": "local_polling", "loggers": ["pymonoprice"], "requirements": ["pymonoprice==0.5"] diff --git a/homeassistant/components/monzo/manifest.json b/homeassistant/components/monzo/manifest.json index dc9a11be3acbe1..fc6668efe18d5f 100644 --- a/homeassistant/components/monzo/manifest.json +++ b/homeassistant/components/monzo/manifest.json @@ -5,6 +5,7 @@ "config_flow": true, "dependencies": ["application_credentials"], "documentation": "https://www.home-assistant.io/integrations/monzo", + "integration_type": "service", "iot_class": "cloud_polling", "requirements": ["monzopy==1.5.1"] } diff --git a/homeassistant/components/motioneye/manifest.json b/homeassistant/components/motioneye/manifest.json index ca99361981fd59..852945ac1c0531 100644 --- a/homeassistant/components/motioneye/manifest.json +++ b/homeassistant/components/motioneye/manifest.json @@ -6,6 +6,7 @@ "config_flow": true, "dependencies": ["http", "webhook"], "documentation": "https://www.home-assistant.io/integrations/motioneye", + "integration_type": "hub", "iot_class": "local_polling", "loggers": ["motioneye_client"], "requirements": ["motioneye-client==0.3.14"] diff --git a/homeassistant/components/roborock/__init__.py b/homeassistant/components/roborock/__init__.py index 3c419873b6672c..c582d00a1af0ef 100644 --- a/homeassistant/components/roborock/__init__.py +++ b/homeassistant/components/roborock/__init__.py @@ -78,6 +78,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: RoborockConfigEntry) -> show_background=entry.options.get(CONF_SHOW_BACKGROUND, False), map_scale=MAP_SCALE, ), + mqtt_session_unauthorized_hook=lambda: entry.async_start_reauth(hass), ) except RoborockInvalidCredentials as err: raise ConfigEntryAuthFailed( diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index c925b3609f6cec..88958cf44c5a72 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -4075,7 +4075,7 @@ }, "mikrotik": { "name": "Mikrotik", - "integration_type": "hub", + "integration_type": "device", "config_flow": true, "iot_class": "local_polling" }, @@ -4110,7 +4110,7 @@ }, "moat": { "name": "Moat", - "integration_type": "hub", + "integration_type": "device", "config_flow": true, "iot_class": "local_push" }, @@ -4150,7 +4150,7 @@ }, "monarch_money": { "name": "Monarch Money", - "integration_type": "hub", + "integration_type": "service", "config_flow": true, "iot_class": "cloud_polling" }, @@ -4167,7 +4167,7 @@ }, "monzo": { "name": "Monzo", - "integration_type": "hub", + "integration_type": "service", "config_flow": true, "iot_class": "cloud_polling" }, diff --git a/tests/components/roborock/test_init.py b/tests/components/roborock/test_init.py index 8aad5fde10e250..352c121e5b4ab4 100644 --- a/tests/components/roborock/test_init.py +++ b/tests/components/roborock/test_init.py @@ -92,6 +92,44 @@ async def test_reauth_started( assert flows[0]["step_id"] == "reauth_confirm" +async def test_mqtt_session_unauthorized_hook_called( + hass: HomeAssistant, + mock_roborock_entry: MockConfigEntry, + device_manager: AsyncMock, +) -> None: + """Test that the mqtt session unauthorized hook is called on unauthorized event.""" + device_manager_kwargs = {} + + def create_device_manager(*args: Any, **kwargs: Any) -> AsyncMock: + nonlocal device_manager_kwargs + device_manager_kwargs = kwargs + return device_manager + + with patch( + "homeassistant.components.roborock.create_device_manager", + side_effect=create_device_manager, + ): + await hass.config_entries.async_setup(mock_roborock_entry.entry_id) + await hass.async_block_till_done() + assert mock_roborock_entry.state is ConfigEntryState.LOADED + + flows = hass.config_entries.flow.async_progress() + assert not flows + + # Simulate an unauthorized event by calling the captured hook + assert device_manager_kwargs + mqtt_session_unauthorized_hook = device_manager_kwargs.get( + "mqtt_session_unauthorized_hook" + ) + assert mqtt_session_unauthorized_hook + mqtt_session_unauthorized_hook() + + # Verify that reauth flow is started + flows = hass.config_entries.flow.async_progress() + assert len(flows) == 1 + assert flows[0]["step_id"] == "reauth_confirm" + + @pytest.mark.parametrize("platforms", [[Platform.IMAGE]]) @pytest.mark.parametrize( ("exists", "is_dir", "rmtree_called"),