1 """Support to control a Salda Smarty XP/XV ventilation unit."""
6 import voluptuous
as vol
16 from .const
import DOMAIN
17 from .coordinator
import SmartyConfigEntry, SmartyCoordinator
19 _LOGGER = logging.getLogger(__name__)
21 CONFIG_SCHEMA = vol.Schema(
25 vol.Required(CONF_HOST): vol.All(ipaddress.ip_address, cv.string),
26 vol.Optional(CONF_NAME, default=
"Smarty"): cv.string,
30 extra=vol.ALLOW_EXTRA,
34 Platform.BINARY_SENSOR,
42 async
def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
43 """Create a smarty system."""
44 if config := hass_config.get(DOMAIN):
49 async
def _async_import(hass: HomeAssistant, config: ConfigType) ->
None:
50 """Set up the smarty environment."""
52 if not hass.config_entries.async_entries(DOMAIN):
54 result = await hass.config_entries.flow.async_init(
55 DOMAIN, context={
"source": SOURCE_IMPORT}, data=config
57 if result[
"type"] == FlowResultType.ABORT:
58 ir.async_create_issue(
61 f
"deprecated_yaml_import_issue_{result['reason']}",
62 breaks_in_ha_version=
"2025.5.0",
65 severity=ir.IssueSeverity.WARNING,
66 translation_key=f
"deprecated_yaml_import_issue_{result['reason']}",
67 translation_placeholders={
69 "integration_title":
"Smarty",
74 ir.async_create_issue(
77 f
"deprecated_yaml_{DOMAIN}",
78 breaks_in_ha_version=
"2025.5.0",
81 severity=ir.IssueSeverity.WARNING,
82 translation_key=
"deprecated_yaml",
83 translation_placeholders={
85 "integration_title":
"Smarty",
91 """Set up the Smarty environment from a config entry."""
95 await coordinator.async_config_entry_first_refresh()
97 entry.runtime_data = coordinator
99 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
105 """Unload a config entry."""
106 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, SmartyConfigEntry entry)
None _async_import(HomeAssistant hass, ConfigType config)
bool async_unload_entry(HomeAssistant hass, SmartyConfigEntry entry)
bool async_setup(HomeAssistant hass, ConfigType hass_config)