### Scripting with hass-cli Bash Example Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Demonstrates how to fetch state data, extract specific fields using jq, and call a service to control a light. Ensure jq is installed for JSON processing. ```bash #!/bin/bash # Get JSON data for processing data=$(hass-cli -o json state list) # Extract specific fields entity=$(echo "$data" | jq -r '.[0].entity_id') # Process results hass-cli service call light.turn_on --arguments entity_id="$entity" ``` -------------------------------- ### Install Home Assistant CLI Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use pip to install the homeassistant-cli package. ```bash pip install homeassistant-cli ``` -------------------------------- ### Get Home Assistant System Info Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use `get_info()` to fetch general information about your Home Assistant system, such as version and installation details. ```python get_info() # Get system info ``` -------------------------------- ### List Services with Regex Filter Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst List available services, optionally filtering them using a regular expression. This example lists services starting with 'home'. ```bash $ hass-cli service list 'home.*toggle' ``` -------------------------------- ### YAML List Examples Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/07-yaml-utilities.md Shows how to define lists in YAML using both inline and block styles. ```yaml # Inline style lights: [light.kitchen, light.bedroom, light.bathroom] # Block style lights: - light.kitchen - light.bedroom - light.bathroom ``` -------------------------------- ### Get Home Assistant Configuration Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use `get_config()` to retrieve the current configuration settings of your Home Assistant instance. This provides insights into your setup. ```python get_config() # Get configuration ``` -------------------------------- ### Install Home Assistant CLI with Pip Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Install the Home Assistant CLI in editable mode using pip. This is useful for development purposes. ```bash pip3 install --editable . ``` -------------------------------- ### Get Detailed Service Information in YAML Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Retrieve detailed information about a specific service, including its description, fields, and examples, using YAML output format. ```bash $ hass-cli -o yaml service list homeassistant.toggle ``` -------------------------------- ### Setup Docker Wrapper Script Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Download and make executable a script to use hass-cli from Docker, enabling auto-completion and environment variable access. ```bash $ curl https://raw.githubusercontent.com/home-assistant/home-assistant-cli/master/docker-hass-cli > hass-cli $ chmod +x hass-cli ``` -------------------------------- ### Plugin Structure Example Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/08-project-structure.md Demonstrates the structure of a typical plugin module, including necessary imports and the definition of Click commands using `@click.group` and `@cli.command`. ```python # homeassistant_cli/plugins/state.py import click from homeassistant_cli.cli import pass_context from homeassistant_cli.config import Configuration @click.group("state") @pass_context def cli(ctx: Configuration) -> None: """Get info on entity state from Home Assistant.""" @cli.command() @click.argument("entity") @pass_context def get(ctx: Configuration, entity: str) -> None: """Get/read entity state from Home Assistant.""" # Implementation ``` -------------------------------- ### Install with Nix Environment Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Install hass-cli on NixOS. The latest release might only be available in the 'unstable' channel. ```bash $ nix-env -iA nixos.home-assistant-cli ``` -------------------------------- ### Get System Info Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/05-cli-commands.md Retrieves system and Home Assistant version information. Use the -o flag to specify output format. ```bash hass-cli system info ``` ```bash hass-cli -o yaml system info ``` -------------------------------- ### List Integrations Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use `get_config_entries()` to list all configured integrations (config entries) in Home Assistant. This provides an overview of installed components. ```python get_config_entries() # List integrations ``` -------------------------------- ### Get All Config Entries Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Retrieve a list of all configuration entries (integrations) configured in Home Assistant. ```python def get_config_entries(ctx: Configuration) -> list[dict[str, Any]] ``` ```python entries = get_config_entries(ctx) ``` -------------------------------- ### Install Latest Pre-release with pip Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Install the latest pre-release version of hass-cli directly from the development branch on GitHub. ```bash $ pip install git+https://github.com/home-assistant-ecosystem/home-assistant-cli@dev ``` -------------------------------- ### Install with DNF on Fedora Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Install hass-cli on Fedora systems using the DNF package manager. Note that distribution packages might be outdated. ```bash $ sudo dnf -y install home-assistant-cli ``` -------------------------------- ### YAML Simple Data Example Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/07-yaml-utilities.md Demonstrates basic YAML data types including strings, numbers, booleans, and null values. ```yaml # String name: "Kitchen Light" # Number temperature: 22.5 brightness: 200 # Boolean active: true enabled: false # Null deprecated: null ``` -------------------------------- ### YAML Complex Example Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/07-yaml-utilities.md A comprehensive example combining various YAML features like nested objects, lists of objects, and complex configurations. ```yaml name: "Home Automation" location: latitude: 37.7749 longitude: -122.4194 timezone: "America/Los_Angeles" areas: - name: Kitchen devices: - name: "Overhead Light" id: light.kitchen_overhead - name: "Counter Light" id: light.kitchen_counter automations: - id: "morning_routine" trigger: platform: time at: "06:00:00" action: - service: light.turn_on entity_id: light.bedroom ``` -------------------------------- ### Install Latest Release with pip Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Use this command to install the latest stable release of hass-cli using pip. ```bash $ pip install homeassistant-cli ``` -------------------------------- ### Install with Homebrew on macOS Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Install hass-cli on macOS using the Homebrew package manager. Distribution releases may be outdated. ```bash $ brew install homeassistant-cli ``` -------------------------------- ### Get Home Assistant Core Info Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/05-cli-commands.md Retrieves information about the Home Assistant Core, including version and system details. ```bash hass-cli ha core info ``` -------------------------------- ### Documentation Coverage Summary Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/VERIFICATION.txt Overview of the documented elements including constants, examples, and overall documentation quality. ```APIDOC ## Documentation Coverage ### Constants Covered: - CLI constants: 5 - WebSocket API types: 12 - REST API URLs: 11 - HTTP status codes: 13 - Entity states: 28 - Service names: 22 - Entity attributes: 30+ - Measurement units: 60+ - Device classes: 14 - Event types: 15 - Configuration keys: 100+ - **Total Constants: 200+ documented** ### Code Examples: - **Total Examples: 90+** - Examples by Category: - Authentication: 5 - State operations: 8 - Service calls: 6 - Event handling: 4 - CLI commands: 30+ - Output formatting: 8 - Bash scripting: 12 - Python integration: 6 - Error handling: 5 - Performance optimization: 3 - Template rendering: 2 - YAML processing: 6 ## Documentation Quality Metrics ### Structure: - Hierarchical organization (10 main modules) - Clear section headings - Cross-references with links - Table of contents in INDEX - Navigation in README ### Content: - Function signatures with full types - Parameter documentation with tables - Return type documentation - Exception/error documentation - Real-world usage examples - Integration patterns ### Format: - Markdown compatible - Code syntax highlighting - Consistent formatting - Proper punctuation - Grammar checked ### Coverage: - All public API functions - All CLI commands - All exported types - All constants - Error handling ## Key Features Documented: - Configuration management - Server auto-detection (Zeroconf) - Authentication methods (3 types) - REST API integration - WebSocket API integration - Supervisor API integration - Output formatting (5 formats) - Custom columns - Error handling and exceptions - YAML parsing and serialization - Plugin architecture - Dynamic command loading - Shell completion - HTTP debugging - Performance optimization - Scripting patterns - Automation examples - Testing patterns ## Verification Summary: ### Status: ✓ COMPLETE ### Objectives Met: - Analyzed 26 Python source files - Documented 45+ API functions - Documented 60+ CLI commands - Documented 200+ constants - Provided 90+ code examples - Generated 4,450+ lines of documentation - Organized in 10 comprehensive modules - Created master index (00-INDEX.md) - Provided navigation guide (README.md) - Covered architecture (08-project-structure.md) - Provided usage patterns (09-usage-patterns.md) ### Documentation Types: - API Reference - Complete - CLI Reference - Complete - Constants Reference - Complete - Exception Reference - Complete - Usage Patterns - Comprehensive - Project Architecture - Complete - Integration Examples - Extensive - Configuration Guide - Complete ### File Organization: - 00-INDEX.md - Navigation & overview - 01-configuration.md - Configuration API - 02-remote-api.md - Remote API functions - 03-exceptions.md - Exception handling - 04-helper-functions.md - Helpers - 05-cli-commands.md - CLI commands - 06-constants.md - Constants - 07-yaml-utilities.md - YAML functions - 08-project-structure.md - Architecture - 09-usage-patterns.md - Examples - README.md - Navigation guide ### Quality Assurance: - No external content (pure source analysis) - Accurate type information - Consistent terminology - Complete API coverage - Practical examples - Error scenarios covered - Cross-referenced sections - Professional formatting ``` -------------------------------- ### Get Home Assistant Release Version in YAML Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Fetch the Home Assistant release version in YAML format using the '--output=yaml' flag. ```bash $ hass-cli --output=yaml config release - 2026.4.1 ``` -------------------------------- ### Test Connectivity Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Verify your connection to Home Assistant by running 'hass-cli system info' to get general system details or 'hass-cli raw GET /api/' to test the REST API endpoint. ```bash hass-cli system info ``` ```bash hass-cli raw GET /api/ ``` -------------------------------- ### Get Home Assistant Instance Info Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Fetches basic information about the Home Assistant instance, including version and location. Useful for quick status checks. ```python def get_info(ctx: Configuration) -> dict[str, Any] Get basic info about the Home Assistant instance. **Returns:** Dictionary with version, location, unit system, etc. **Example:** ```python info = get_info(ctx) print(f"Version: {info.get('version')}") ``` ``` -------------------------------- ### Get Single Integration Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use `get_config_entry()` to retrieve details about a specific integration (config entry) in Home Assistant. ```python get_config_entry() # Get single integration ``` -------------------------------- ### Get Home Assistant Release Version Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Retrieve the current release version of your Home Assistant server using the 'config release' command. ```bash $ hass-cli config release VERSION 2026.4.1 ``` -------------------------------- ### Get Available Services Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Retrieves a list of all available services in Home Assistant. Useful for discovering service domains and names. ```python def get_services(ctx: Configuration) -> list[dict[str, Any]] Get list of all available services. **Returns:** List of service dictionaries with domain, service name, and description **Example:** ```python services = get_services(ctx) light_services = [s for s in services if s["domain"] == "light"] ``` ``` -------------------------------- ### Automation with Cron Jobs Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Provides examples of cron job entries to schedule Home Assistant script execution at specific times. Ensure the hass-cli path is correctly configured in your cron environment. ```bash # /etc/cron.d/home_automation 0 6 * * * hass-cli service call script.morning_routine 0 23 * * * hass-cli service call script.evening_routine ``` -------------------------------- ### Get Home Assistant Configuration Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Retrieves the running configuration dictionary of the Home Assistant instance. Use this to access settings like unit system and location. ```python def get_config(ctx: Configuration) -> dict[str, Any] Get the running configuration dictionary. **Returns:** Configuration structure with unit system, location, etc. **Example:** ```python config = get_config(ctx) print(f"Unit system: {config.get('unit_system')}") ``` ``` -------------------------------- ### Display Configuration in YAML Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/07-yaml-utilities.md Show Home Assistant configuration information formatted as YAML using the -o yaml flag. ```bash # Show config in YAML format hass-cli -o yaml config info ``` -------------------------------- ### Get Entity History with Time Filter Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Retrieve the state history for one or more entities within a specified time frame. This example fetches history for the last 50 minutes. ```bash $ hass-cli state history --since 50m light.kitchen_light_1 binary_sensor.presence_kitchen ``` -------------------------------- ### List Home Assistant Areas Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use `get_areas()` to list all defined areas in your Home Assistant setup. This is useful for organizing and managing devices by location. ```python get_areas() # List areas ``` -------------------------------- ### JSON and YAML Output Processing with hass-cli Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/09-usage-patterns.md Process Home Assistant CLI output in JSON or YAML formats using tools like jq for data extraction and manipulation. Examples include getting configuration details and counting entities. ```bash # Extract specific field using jq version=$(hass-cli -o json config release | jq -r '.[0]') # Parse YAML and get value config=$(hass-cli -o yaml config info) # Count entities of type light_count=$(hass-cli -o json state list "^light\." | jq 'length') echo "Total lights: $light_count" # List entities with specific state hass-cli -o json state list | jq '.[] | select(.state=="on") | .entity_id' ``` -------------------------------- ### Set Up Development Environment for Home Assistant CLI Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Set up a virtual environment for developing the Home Assistant CLI. This ensures isolation from your system's Python packages. ```bash python3 -m venv . $ source bin/activate $ script/setup ``` -------------------------------- ### List Entity States with Custom Columns Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Use the --columns flag to specify which data to display when listing entity states. This example shows how to retrieve entity IDs and all attributes. ```bash $ hass-cli --columns=ENTITY="entity_id,ATTRIBUTES=attributes[*"]" state list zone ``` -------------------------------- ### get_info() Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Fetches basic information about the Home Assistant instance, including version and system settings. ```APIDOC ## get_info() ### Description Get basic info about the Home Assistant instance. ### Returns Dictionary with version, location, unit system, etc. ### Example ```python info = get_info(ctx) print(f"Version: {info.get('version')}") ``` ``` -------------------------------- ### List all Home Assistant Integrations Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/05-cli-commands.md Lists all configured integrations. Accepts an optional regex filter to narrow down the results. ```bash hass-cli integration list [FILTER] ``` ```bash hass-cli integration list ``` ```bash hass-cli integration list mqtt ``` -------------------------------- ### Initialize Configuration Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/01-configuration.md Creates a new Configuration instance with default values. All configuration attributes are initialized to safe defaults. ```python def __init__(self) -> None: pass ``` -------------------------------- ### Call Backup Service Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Initiate a backup creation process by calling the 'backup.create' service. Use 'service list' to find available services. ```bash $ hass-cli service call backup.create ``` -------------------------------- ### Configure Home Assistant CLI Environment Variables Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Set these environment variables if your Home Assistant installation is secured or not running on the default localhost:8123 address. Ensure HASS_SERVER points to your Home Assistant instance and HASS_TOKEN contains a valid long-lived access token. ```bash export HASS_SERVER=http://homeassistant.local:8123 export HASS_TOKEN=eyJ0eXAiO-----------------------ed8mj0NP8 ``` -------------------------------- ### Configuration Entry Point with Decorators Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/08-project-structure.md The `cli()` function is decorated with Click decorators to register global options and configure the CLI class, setting up the main command-line interface. ```python @click.command(cls=HomeAssistantCli, context_settings=CONTEXT_SETTINGS) @click_log.simple_verbosity_option(logging.getLogger(), "--loglevel", "-l") @click.version_option(const.__version__) # ... more decorators for each option def cli(ctx: Configuration, ...) -> None: """Command line interface for Home Assistant.""" ``` -------------------------------- ### Get Specific Entity State Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/00-INDEX.md Use the 'state get' command followed by the entity ID to fetch the current state of a specific entity. ```bash hass-cli state get light.kitchen ``` -------------------------------- ### Format Data Using Configuration Context Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/04-helper-functions.md Use format_output as a convenience wrapper around raw_format_output, applying output format settings from a Configuration context. It can optionally use provided columns or default to ctx.columns. ```python from homeassistant_cli.helper import format_output states = get_states(ctx) output = format_output(ctx, states) ctx.echo(output) ``` -------------------------------- ### Home Assistant CLI Global Options Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/05-cli-commands.md Demonstrates the general structure for using global options with Home Assistant CLI commands. These options are applied before the command itself. ```bash hass-cli [GLOBAL_OPTIONS] COMMAND ``` -------------------------------- ### Graceful Error Handling for Hass CLI State Get Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/09-usage-patterns.md Implement a safe function to get entity state, handling errors by returning a default value and suppressing stderr output. ```bash #!/bin/bash get_state_safe() { local entity=$1 local default=$2 if result=$(hass-cli -o json state get "$entity" 2>/dev/null); then echo "$result" | jq -r '.state' else echo "${default:-"unknown"}" fi } # Usage temp=$(get_state_safe "sensor.temperature" "unknown") echo "Temperature: $temp" ``` -------------------------------- ### Configuration Class Constructor Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/01-configuration.md Initializes a new Configuration instance with default settings. This is the entry point for managing CLI configuration. ```APIDOC ## Constructor ```python def __init__(self) -> None ``` Creates a new Configuration instance with default values. All configuration attributes are initialized to safe defaults. ``` -------------------------------- ### get_state() Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Get the current state of a single entity. ```APIDOC ## get_state() ### Description Get the current state of a single entity. ### Parameters - `entity_id` (str): Entity ID (e.g., "light.kitchen") ### Returns State dictionary, or None if entity not found ### Example ```python state = get_state(ctx, "light.kitchen") if state: print(f"State: {state['state']}") print(f"Brightness: {state['attributes'].get('brightness')}") ``` ``` -------------------------------- ### get_config() Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Retrieves the entire running configuration dictionary of the Home Assistant instance. ```APIDOC ## get_config() ### Description Get the running configuration dictionary. ### Returns Configuration structure with unit system, location, etc. ### Example ```python config = get_config(ctx) print(f"Unit system: {config.get('unit_system')}") ``` ``` -------------------------------- ### Show CLI Information Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/05-cli-commands.md Displays information about the Home Assistant CLI itself, including its version and configuration. ```bash hass-cli info ``` -------------------------------- ### Get Entity State Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Retrieves the current state of a specific entity, with options for YAML or JSON output. ```APIDOC ## Get Entity State ### Description Retrieves the current state of a specific entity, with options for YAML or JSON output. ### Command ```bash hass-cli state get ``` ### Options - `-o ` or `--output-format `: Specify output format (e.g., `yaml`, `json`). ### Example ```bash $ hass-cli -o yaml state get light.guestroom_light ``` ``` -------------------------------- ### Control Light State Using State Constants Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/06-constants.md Utilize `hass.SERVICE_TURN_ON` and `hass.STATE_ON` constants to control and check the state of lights. Ensure `get_state` is imported or available in the scope. ```python import homeassistant_cli.hassconst as hass from homeassistant_cli.remote import call_service # Turn on a light call_service(ctx, "light", hass.SERVICE_TURN_ON, { "entity_id": "light.kitchen", "brightness": 255 }) # Check if light is on state = get_state(ctx, "light.kitchen") if state["state"] == hass.STATE_ON: print("Light is on") ``` -------------------------------- ### Home Assistant CLI Directory Structure Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/08-project-structure.md Illustrates the modular plugin architecture and file organization of the Home Assistant CLI project. ```tree homeassistant_cli/ ├── __init__.py # Package initialization ├── cli.py # Main CLI entry point and HomeAssistantCli class ├── config.py # Configuration class and server resolution ├── const.py # CLI constants ├── exceptions.py # Exception classes ├── hassconst.py # Home Assistant constants ├── helper.py # Output formatting utilities ├── yaml.py # YAML parsing utilities ├── remote.py # REST and WebSocket API wrapper ├── autocompletion.py # Shell autocompletion support ├── plugins/ # Command plugins │ ├── __init__.py │ ├── area.py # Area management commands │ ├── config.py # Configuration commands │ ├── device.py # Device management commands │ ├── discover.py # Network discovery commands │ ├── entity.py # Entity management commands │ ├── event.py # Event commands │ ├── ha.py # Home Assistant OS commands │ ├── info.py # CLI info commands │ ├── integration.py # Config entry commands │ ├── map.py # Map display commands │ ├── raw.py # Raw API commands │ ├── service.py # Service call commands │ ├── state.py # State management commands │ ├── system.py # System info commands │ ├── template.py # Template rendering commands │ └── completion.py # Shell completion commands ``` -------------------------------- ### Get Single Entity Information Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/02-remote-api.md Retrieves detailed registry information for a specific entity using its entity ID. ```python def get_entity(ctx: Configuration, entity_id: str) -> list[dict[str, Any]] Get registry information for a single entity. **Parameters:** - `entity_id` (str): Entity ID **Returns:** Entity registry ID or list **Example:** ```python entity_id = get_entity(ctx, "light.kitchen") ``` ``` -------------------------------- ### Discover Instances Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/05-cli-commands.md Discovers Home Assistant instances on the local network. ```APIDOC ## discover ### Description Discover Home Assistant instances on the local network. ### Command hass-cli discover ### Output List of discovered instances with URLs ### Example ```bash hass-cli discover ``` ``` -------------------------------- ### Create YAML Parser Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/_autodocs/07-yaml-utilities.md Instantiate a YAML parser object from the Configuration. This is the first step before loading or dumping YAML. ```python ctx.yaml() -> YAML ``` ```python yamlp = ctx.yaml() ``` -------------------------------- ### Get State History Source: https://github.com/home-assistant-ecosystem/home-assistant-cli/blob/dev/README.rst Retrieves the history of state changes for one or more entities within a specified time range. ```APIDOC ## Get State History ### Description Retrieves the history of state changes for one or more entities within a specified time range. ### Command ```bash hass-cli state history [--since