{"id":4565,"library":"homeassistant","title":"Home Assistant Core","description":"Home Assistant Core is the open-source home automation platform's Python foundation, providing a robust, event-driven framework for observing states, controlling devices, and automating tasks. It is actively developed with monthly releases, currently at version 2026.4.2.","status":"active","version":"2026.4.2","language":"en","source_language":"en","source_url":"https://github.com/home-assistant/core","tags":["home automation","IoT","smart home","platform","asyncio","integration development"],"install":[{"cmd":"pip install homeassistant","lang":"bash","label":"Install Home Assistant Core"}],"dependencies":[{"reason":"Home Assistant Core requires Python 3.14.2 or later to run.","package":"Python","optional":false}],"imports":[{"note":"The central coordinator object for Home Assistant operations.","symbol":"HomeAssistant","correct":"from homeassistant.core import HomeAssistant"},{"note":"Used for managing UI-based integration configurations.","symbol":"ConfigEntry","correct":"from homeassistant.config_entries import ConfigEntry"},{"note":"Common constant used to define an integration's unique identifier.","symbol":"DOMAIN","correct":"from homeassistant.const import DOMAIN"},{"note":"Used for defining entity platforms (e.g., light, sensor).","symbol":"Platform","correct":"from homeassistant.const import Platform"},{"note":"The primary asynchronous entry point for setting up UI-configured integrations.","symbol":"async_setup_entry","correct":"from homeassistant.config_entries import ConfigEntry\nasync def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:"}],"quickstart":{"code":"import asyncio\nfrom homeassistant.core import HomeAssistant, CoreState\n\nasync def run_hass_instance():\n    hass = HomeAssistant(\".homeassistant\") # Use a temporary config directory\n    await hass.async_start()\n    print(f\"Home Assistant started. State: {hass.state}\")\n\n    # Example: Set a state (e.g., for a custom sensor)\n    hass.states.async_set(\"test.hello_world\", \"Hello from Python!\")\n    print(f\"State of test.hello_world: {hass.states.get('test.hello_world').state}\")\n\n    # Keep running for a short period or until manually stopped\n    await asyncio.sleep(5)\n\n    await hass.async_stop()\n    print(\"Home Assistant stopped.\")\n\nif __name__ == \"__main__\":\n    # Note: Running Home Assistant Core programmatically like this is mostly for testing or specific advanced scenarios.\n    # For typical development, you would create a custom component and run HA via its standard entrypoint.\n    try:\n        asyncio.run(run_hass_instance())\n    except KeyboardInterrupt:\n        print(\"Operation interrupted by user.\")","lang":"python","description":"This quickstart demonstrates how to programmatically start and interact with a basic Home Assistant Core instance, primarily for testing or embedding purposes. For integration development, you would typically use the `python3 -m script.scaffold integration` command within a development environment to generate a boilerplate custom component structure, then implement your logic in `__init__.py`, `config_flow.py`, and entity platform files."},"warnings":[{"fix":"Always read the official release notes and breaking changes log before updating. Pay attention to warnings in logs and repair issues in the UI.","message":"Home Assistant undergoes monthly releases, often including breaking changes. Users must diligently review release notes and the 'Backward-incompatible changes' section before updating to avoid unexpected issues.","severity":"breaking","affected_versions":"All versions (on major/minor updates)"},{"fix":"Use a linter (e.g., `yamllint`) or a text editor with strong YAML support. Pay close attention to spacing and indentation in configuration files.","message":"YAML configuration is crucial for Home Assistant, and incorrect indentation is a leading cause of errors. This can lead to configurations or automations failing silently or behaving unexpectedly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use more robust storage like an SSD (via USB adapter for Raspberry Pi) or a network-attached storage solution. Ensure regular, automated backups are in place.","message":"Running Home Assistant on an SD card (e.g., on a Raspberry Pi) for extended periods can lead to SD card wear and failure due to frequent write operations (logs, state changes). This can result in data loss or system instability.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Exercise caution when using custom components. Follow their respective repositories for updates and compatibility information. Report issues to the custom component's maintainer, not Home Assistant Core developers. Minimize their use if stability is paramount.","message":"Custom components are community-maintained and, unlike official integrations, may not receive immediate updates for breaking changes in Home Assistant Core. They can cause instability or break functionality after a core update.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For advanced scripting with full Python library access, consider using AppDaemon or pyscript integrations instead of `python_script`.","message":"The `python_script` integration is a sandboxed environment and does not allow arbitrary Python imports. Developers accustomed to full Python scripting often find this limitation restrictive.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}