40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
"""The Spider integration."""
 | 
						|
 | 
						|
from __future__ import annotations
 | 
						|
 | 
						|
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
 | 
						|
from homeassistant.core import HomeAssistant
 | 
						|
from homeassistant.helpers import issue_registry as ir
 | 
						|
 | 
						|
DOMAIN = "spider"
 | 
						|
 | 
						|
 | 
						|
async def async_setup_entry(hass: HomeAssistant, _: ConfigEntry) -> bool:
 | 
						|
    """Set up Spider from a config entry."""
 | 
						|
    ir.async_create_issue(
 | 
						|
        hass,
 | 
						|
        DOMAIN,
 | 
						|
        DOMAIN,
 | 
						|
        is_fixable=False,
 | 
						|
        severity=ir.IssueSeverity.ERROR,
 | 
						|
        translation_key="integration_removed",
 | 
						|
        translation_placeholders={
 | 
						|
            "link": "https://www.ithodaalderop.nl/additionelespiderproducten",
 | 
						|
            "entries": "/config/integrations/integration/spider",
 | 
						|
        },
 | 
						|
    )
 | 
						|
 | 
						|
    return True
 | 
						|
 | 
						|
 | 
						|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
 | 
						|
    """Unload a config entry."""
 | 
						|
    if all(
 | 
						|
        config_entry.state is ConfigEntryState.NOT_LOADED
 | 
						|
        for config_entry in hass.config_entries.async_entries(DOMAIN)
 | 
						|
        if config_entry.entry_id != entry.entry_id
 | 
						|
    ):
 | 
						|
        ir.async_delete_issue(hass, DOMAIN, DOMAIN)
 | 
						|
 | 
						|
    return True
 |