{"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":"python","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,"search_vec":"'2026.4.2':43 'activ':35 'assist':2,5 'asyncio':50 'autom':13,31,45 'control':28 'core':3,6 'current':40 'develop':36,52 'devic':29 'driven':23 'event':22 'event-driven':21 'foundat':17 'framework':24 'home':1,4,12,44,48 'integr':51 'iot':46 'month':38 'observ':26 'open':10 'open-sourc':9 'platform':14,49 'provid':18 'python':16 'releas':39 'robust':20 'smart':47 'sourc':11 'state':27 'task':32 'version':42","created_at":"2026-04-12T13:58:04.967642+00:00","updated_at":"2026-04-16T15:35:34.482480+00:00","problems":[{"fix":"Use the Home Assistant 'Configuration validation' tool (Developer Tools > YAML > YAML configuration and click 'Check Configuration') to pinpoint the exact error, then correct the YAML syntax or parameter values.","cause":"The Home Assistant configuration (often `configuration.yaml` or related files) contains syntax errors, incorrect indentation, or invalid parameters for a specific integration or platform.","error":"Invalid config for [component]:"},{"fix":"Ensure Home Assistant is run within its dedicated virtual environment (if applicable) or that the `homeassistant` package is correctly installed and accessible in the Python environment being used. For virtual environments, activate it using `source /path/to/venv/bin/activate` before executing `hass` or any related scripts.","cause":"The Python environment where Home Assistant is being executed does not have the `homeassistant` package installed or the execution path is incorrect, often occurring when running custom scripts outside the main Home Assistant process.","error":"ModuleNotFoundError: No module named 'homeassistant'"},{"fix":"Update the custom component or configuration to align with the current Home Assistant API. Check the integration's documentation, Home Assistant release notes, or the custom component's GitHub page for updates and breaking changes relevant to your Home Assistant version.","cause":"This typically occurs after a Home Assistant update where internal module structures, constant names, or helper functions have changed within the core or its components, breaking custom components or older configurations that rely on the previous API.","error":"ImportError: cannot import name 'XYZ' from 'homeassistant.components.ABC.const'"},{"fix":"Review the Home Assistant developer documentation and the specific integration's changelog for API updates. Update the custom component or script to use the current, valid methods and attributes provided by the Home Assistant core.","cause":"This usually indicates that a method or attribute called on the `HomeAssistant` object (or other core objects) no longer exists in the current Home Assistant version due to API changes, often affecting custom integrations or scripts.","error":"AttributeError: 'HomeAssistant' object has no attribute 'helpers'"},{"fix":"Verify that the custom component files are in the correct `custom_components` directory (e.g., `/config/custom_components/[component_name]`), ensuring the folder structure and `__init__.py` file are correct. Double-check the integration's name for typos in `configuration.yaml` and restart Home Assistant after making changes.","cause":"Home Assistant cannot locate or load the integration files. This can be due to incorrect placement of custom component files, a typo in the `configuration.yaml`, or issues during the installation/loading process (e.g., via HACS).","error":"Component error: [component_name] - Integration '[component_name]' not found."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2026.8.3","cli_name":"hass","cli_version":"","type":"library","homepage":"https://www.home-assistant.io/","github":"https://github.com/home-assistant/core","docs":null,"changelog":null,"pypi":"https://pypi.org/project/homeassistant/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","communication","database","http-networking","observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}