spook icon indicating copy to clipboard operation
spook copied to clipboard

Spook reports a false positive “Unknown entities used” warning when using a Jinja template with startswith() to filter entities.

Open Csontikka opened this issue 3 months ago • 1 comments

What version of Spook are you using?

v4.0.1

What version of Home Assistant are you using?

2025.9.4

The problem

Spook reports a false positive “Unknown entities used” warning when using a Jinja template with startswith() to filter entities.

The warning:

This automation references the following entities, which are unknown to Home Assistant:

binary_sensor.proxmox

Spook treats this as if I were referencing a concrete entity called binary_sensor.proxmox, but it’s only a string prefix, not a real entity.

alias: Proxmox - Host status monitoring
description: >-
  Checks the Proxmox host sensors every hour and sends a status message – only
  in debug mode if everything is fine.
triggers:
  - minutes: 0
    trigger: time_pattern
conditions: []
actions:
  - variables:
      debug_mode: "{{ is_state('input_boolean.telegram_debug_active', 'on') }}"
      error_sensors_list: >-
        {% set errors = namespace(list=[]) %} {% for entity in
        states.binary_sensor if
        entity.entity_id.startswith('binary_sensor.proxmox') %}
          {% if entity.state != 'on' %}
            {% set errors.list = errors.list + [entity.name ~ ' (' ~ entity.state ~ ')'] %}
          {% endif %}
        {% endfor %} {{ errors.list }}
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ error_sensors_list | count > 0 }}"
        sequence:
          - data:
              message: >-
                ⚠️ Proxmox host alert: Number of inactive hosts: {{
                error_sensors_list | count }} {% for sensor in
                error_sensors_list %}
                  - {{ sensor.replace('_', ' ') }}
                {% endfor %}
            action: notify.telegram_proxmox
    default:
      - condition: template
        value_template: "{{ debug_mode }}"
      - data:
          message: ✅ [DEBUG] All Proxmox hosts are available.
        action: notify.telegram_proxmox
mode: single

Thanks a lot for developing Spook — it’s an incredibly useful tool!

Anything in the logs? Paste it here!


Csontikka avatar Sep 29 '25 18:09 Csontikka

This is my workaround, so Spook does not flag it anymore:

entity.entity_id.startswith("binary_sensor." + "proxmox")

Csontikka avatar Sep 30 '25 18:09 Csontikka