Skip to content

[Bug] Modern 'template:' integration (sensor/switch) fails silently or with parser errors in Core 2025.5.3 #145567

Description

@Jolo-Jan

The problem

The problem

The modern template: integration (introduced to replace legacy top-level sensor: - platform: template, etc.) does not seem to work correctly in Home Assistant Core 2025.5.3.

Attempts to create template: - switch: entities either result in parser errors ('value_template' is an invalid option for 'template') even with seemingly correct YAML, or they fail silently without creating entities, even when the configuration check passes and no errors are logged.

Even a simple template: - sensor: entity fails to be created (silently, without errors) when placed directly in configuration.yaml.

Environment

  • Home Assistant Core: 2025.5.3
  • Installation Type: Home Assistant OS
  • Supervisor: 2025.05.1
  • Operating System: 6.12.23-haos
  • Hardware: Dell Wyse 5070 | Intel J4105 | 8GB RAM | 512GB SSD
  • default_config: is enabled.

Steps to Reproduce

We tried several methods to create template entities:

1. Template Switch directly in configuration.yaml:

  • Code used:
    template:
      - switch:
          - name: "Garten Schalter 1 (Icon)"
            value_template: "{{ is_state('switch.garten_schalter_1', 'on') }}"
            turn_on:
              service: switch.turn_on
              target:
                entity_id: switch.garten_schalter_1
            turn_off:
              service: switch.turn_off
              target:
                entity_id: switch.garten_schalter_1
            icon_template: >-
              {% if is_state('switch.garten_schalter_1', 'on') %}
                mdi:water-pump
              {% else %}
                mdi:water-pump-off
              {% endif %}
            unique_id: garten_schalter_1_template_icon_test
  • Result: Invalid config for 'template' ... 'value_template' is an invalid option for 'template', check: switch->0->value_template. This error points to a valid key as invalid.

2. Template Switch via !include templates.yaml:

  • configuration.yaml: template: !include templates.yaml
  • templates.yaml: (Content as above, starting with - switch:)
  • Result: Config check passed, but after restart, the same error appeared in the logs, and the entity was not created.

3. Template Sensor ONLY via !include templates.yaml:

  • configuration.yaml: template: !include templates.yaml
  • templates.yaml:
    - sensor:
        - name: "Test Template Sensor"
          state: "{{ now().isoformat() }}"
          unique_id: test_template_sensor_12345
  • Result: Config check passed, restart caused no errors, but the sensor entity was not created.

4. Template Sensor ONLY directly in configuration.yaml:

  • configuration.yaml:
    template:
      - sensor:
          - name: "Test Template Sensor Direkt"
            state: "{{ now().isoformat() }}"
            unique_id: test_template_sensor_12345_direct
  • Result: Config check passed, restart caused no errors, but the sensor entity was still not created.

Expected behavior

Template entities (sensors, switches) defined using the modern template: integration structure should be created successfully when the configuration is valid.

Actual behavior

Template entities are not created. Either the configuration fails with incorrect parser errors, or it fails silently after a restart, even when the configuration check passes and no errors are logged.

Logs

The key error when using switch is:

Invalid config for 'template' at <file>, line <X>: 'value_template' is an invalid option for 'template', check: switch->0->value_template
Invalid config for 'template' at <file>, line <Y>: 'icon_template' is an invalid option for 'template', check: switch->0->icon_template

When using only the sensor (Attempts 3 & 4), no errors appeared in the logs, but the entity was not created.

Additional information

This behaviour seems to indicate a fundamental issue with how the template: integration loads or parses configurations in Core 2025.5.3, affecting both !include and direct configuration, and both switch and sensor platforms.

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image

What version of Home Assistant Core has the issue?

2025.5.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Template

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

# In configuration.yaml
template:
  - sensor:
      - name: "Test Template Sensor Direkt"
        state: "{{ now().isoformat() }}"
        unique_id: test_template_sensor_12345_direct

Anything in the logs that might be useful for us?

when trying to configure a 'template: - switch:', the following error appears, incorrectly marking valid keys as invalid:

Invalid config for 'template' at <file>, line <X>: 'value_template' is an invalid option for 'template', check: switch->0->value_template
Invalid config for 'template' at <file>, line <Y>: 'icon_template' is an invalid option for 'template', check: switch->0->icon_template

Crucially, when trying to configure *only* a simple 'template: - sensor:', **NO errors** appear in the logs, but the entity is still not created.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions