Repository: home-assistant/core
File: homeassistant/components/shelly/repairs.py (Python)

Code before:
@callback
def async_manage_coiot_unconfigured_issue(
    hass: HomeAssistant,
    entry: ShellyConfigEntry,
) -> None:
    """Manage the CoIoT unconfigured issue."""
    issue_id = COIOT_UNCONFIGURED_ISSUE_ID.format(unique=entry.unique_id)

    if TYPE_CHECKING:
        assert entry.runtime_data.block is not None

    device = entry.runtime_data.block.device

    if device.model == MODEL_PLUG:
        # Shelly Plug Gen 1 does not have CoIoT settings
        ir.async_delete_issue(hass, DOMAIN, issue_id)
        return

    coiot_config = device.settings["coiot"]
    coiot_enabled = coiot_config.get("enabled")

    # Check if CoIoT is disabled or peer address is not correctly set
    if not coiot_enabled or (
        coiot_enabled
        and (peer_config := coiot_config.get("peer"))
        and peer_config != get_coiot_address(hass)
    ):
        ir.async_create_issue(
            hass,
            DOMAIN,
            issue_id,
            is_fixable=True,
            is_persistent=False,
            severity=ir.IssueSeverity.WARNING,
            translation_key="coiot_unconfigured",
            translation_placeholders={
                "device_name": device.name,
                "ip_address": device.ip_address,
            },
            data={"entry_id": entry.entry_id},
        )
        return

    ir.async_delete_issue(hass, DOMAIN, issue_id)


@callback
def async_manage_open_wifi_ap_issue(
    hass: HomeAssistant,
    entry: ShellyConfigEntry,
) -> None:

Review comment (suggestion):
```suggestion
    if not coiot_enabled or (
        (peer_config := coiot_config.get("peer"))
        and peer_config != get_coiot_address(hass)
    ):
```
Don't need to check `coiot_enabled` twice

Code after:
@callback
def async_manage_coiot_unconfigured_issue(
    hass: HomeAssistant,
    entry: ShellyConfigEntry,
) -> None:
    """Manage the CoIoT unconfigured issue."""
    issue_id = COIOT_UNCONFIGURED_ISSUE_ID.format(unique=entry.unique_id)

    if TYPE_CHECKING:
        assert entry.runtime_data.block is not None

    device = entry.runtime_data.block.device

    if device.model == MODEL_PLUG:
        # Shelly Plug Gen 1 does not have CoIoT settings
        ir.async_delete_issue(hass, DOMAIN, issue_id)
        return

    coiot_config = device.settings["coiot"]
    coiot_enabled = coiot_config.get("enabled")

    # Check if CoIoT is disabled or peer address is not correctly set
    if not coiot_enabled or (
        (peer_config := coiot_config.get("peer"))
        and peer_config != get_coiot_address(hass)
    ):
        ir.async_create_issue(
            hass,
            DOMAIN,
            issue_id,
            is_fixable=True,
            is_persistent=False,
            severity=ir.IssueSeverity.WARNING,
            translation_key="coiot_unconfigured",
            translation_placeholders={
                "device_name": device.name,
                "ip_address": device.ip_address,
            },
            data={"entry_id": entry.entry_id},
        )
        return

    ir.async_delete_issue(hass, DOMAIN, issue_id)


@callback
def async_manage_open_wifi_ap_issue(
    hass: HomeAssistant,
    entry: ShellyConfigEntry,
) -> None:
    """Manage the open WiFi AP issue."""