Spook Documentation

repository·main·Indexed 22 days ago

https://github.com/frenck/spook

A custom integration for Home Assistant that provides advanced tools and features to extend native functionality. Spook adds capabilities for programmatically managing areas, floors, labels, entities, and devices; extends actions for input_number, input_select, and number entities; provides utilities for importing blueprints via URL, cleaning up orphaned entities, and managing user accounts; and includes issue reporting via the Home Assistant repairs dashboard.

Tokens
25K
Snippets
83
Records
178
Agent score
73%

What's inside Spook

  1. What is Spook and what does it do?

    main

    Spook is a custom integration for Home Assistant designed to extend native functionality and add new features that are outside the scope or philosophy of the core Home Assistant project.

    Key capabilities include:

    • Extending Actions: Adds new features to existing Home Assistant actions and introduces entirely new ones for use in automations and scripts.
    • Adding Entities: Injects new entities into existing integrations to provide additional data points for monitoring and control (e.g., monitoring Home Assistant Cloud connections).
    • Issue Reporting: Monitors your Home Assistant instance for potential configuration issues, such as non-existing entities used in automations, and reports them via the Home Assistant repairs dashboard.
  2. What is Spook?

    main

    Spook is a custom integration designed for use with Home Assistant. It extends a Home Assistant instance by providing a wide range of additional tools and capabilities.

    Note: Spook is not affiliated with, endorsed, recommended, or supported by the official Home Assistant project. It is provided as-is without warranty.

  3. Understand the licensing for Spook

    main

    Spook is distributed under multiple licenses depending on the specific component or material being used. The primary licenses mentioned in the repository documentation include:

    • MIT License: A permissive license that allows for reuse within proprietary software provided that all copies of the licensed software include a copy of the MIT License and copyright notice.
    • Creative Commons CC0 1.0 Universal: A public domain dedication that allows users to copy, modify, and distribute the work, even for commercial purposes, without asking permission.
    • Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International: A restrictive license that allows for sharing and adaptation for non-commercial purposes only, provided proper attribution is given and no derivative works are shared.

    Always check the specific LICENSE file in the root of the project or the specific subdirectory of the component you are using to determine the exact terms applicable to your use case.

  4. View Spook enhanced Home Assistant integrations

    main

    Spook provides enhancements (referred to as 'ectoplasmic goodness') for various core Home Assistant integrations. These enhancements typically add extra validation, better entity attributes, or improved functionality to existing Home Assistant components.

    Supported integrations include:

    • Core Logic & Automation: Automations, Blueprints, Scripts, Scenes, and Repairs.
    • Helpers & Inputs: Groups, Input number, Input select, Number, Select, Switch as X, and Timer.
    • Sensors & Data: Proximity, Recorder, Riemann sum integral, Trend, and Utility meter.
    • System & Presence: Dashboards / Lovelace, Home Assistant Cloud, Person, and Zone.
  5. Enhance Home Assistant Cloud with Spook

    main
    Spook enhances the Home Assistant Cloud integration (provided by Nabu Casa) by creating a dedicated device and a series of switch entities. These entities allow you to control cloud connections, state reporting, and remote access directly through Home Assistant dashboards, automations, and scripts.
  6. What is Spook and what are its goals?

    main

    Spook is a custom integration for Home Assistant designed as a powerful toolbox to fill the gap between the core Home Assistant project and the community's feature requests. It acts as a 'rebel' integration, intentionally bypassing standard architectural constraints to provide advanced functionality that might be considered out-of-scope or too risky for the core Home Assistant project.

    Core Goals:

    • Extend Integrations: Adds new actions to existing Home Assistant integrations for use in automations and scripts.
    • Enhance Native Actions: Injects new options or functionality into existing native Home Assistant integration actions.
    • Add Entities: Provides extra or new entities to existing integrations to increase available data points for monitoring and control.
    • Instance Health: Identifies and raises issues on your Home Assistant repairs dashboard to help maintain a healthy, clean, and tidy instance.
    • Experimental Features: Serves as a testing ground for features that may eventually be merged into Home Assistant core.
  7. What is the Switch as X helper?

    main

    The Switch as X helper is a utility that allows you to convert a standard Home Assistant switch entity into a different entity type that better matches its actual function. This is useful for devices like smart plugs or relays that control specific appliances.

    Supported conversions include turning a switch into a:

    • Light
    • Cover (e.g., for garage doors or blinds)
    • Fan
    • Lock
    • Siren

    The helper creates a new entity of the target type which mirrors the state and commands of the original source switch.

  8. Dynamic zone management use cases

    main

    The enhanced zone actions in Spook allow for dynamic location tracking.

    Example Scenario: You can use automations to dynamically create or update zones around moving objects like a car or a person. This enables logic such as:

    • Identifying who is currently near a specific vehicle.
    • Sending notifications when a user approaches a specific person.
  9. Understand Home Assistant Actions and Responses

    main

    An Action is a method that can be performed to control devices, entities, or perform other tasks like sending notifications, starting scripts, or querying services.

    Action Types and Responses

    Actions behave differently regarding their return values:

    • No response: The most common type; these do not return data. You cannot use the response_variable option with these.
    • Optional response: These may return data. You can use the response_variable option.
    • Always has a response: These always return data, and using the response_variable option is required.

    Action Targets

    Actions can be targeted at specific devices, entities, or areas using the target parameter. For example, targeting an area like 'living room' will cause Home Assistant to resolve all entities within that area.

  10. Use Template Filters and Functions

    main

    Home Assistant uses the Jinja2 template engine to dynamically generate values.

    Template Functions

    Functions used within templates to perform operations on data (e.g., now() for current time or is_state() to check an entity's state).

    Template Filters

    Filters modify the output of a template. They are applied using the pipe character (|). You can chain multiple filters together.

    Template Test Functions

    Special functions used to check conditions, typically used with the is operator (e.g., 3 is odd).

    {# Basic filter #}
    {{ "SPOOK" | lower }}
    
    {# Chained filters #}
    {{ "SPOOK" | lower | capitalize }}
    
    {# Test function #}
    {{ 3 is odd }}