Migrating legacy templates to the new template section

I don’t know. Maybe I’m just making more errors recently but it seemed to only start for me in the release right before this one…so 2021.7.

I’m quite sure, I read anywhere about something changing with the “Check Config”…I’ll take a look at the blog posts about new releases… :slight_smile:

I thought it had always been regarded as less thorough than the ssh check method… I’ve been using an appdaemon app precisely because of this

Are there some example configs to show where validation passes when it shouldn’t? Genuinely curious. I should maybe go double check my logs.

I wasn’t aware there was a difference. As far as I know, there’s only one REST API call to check the configuration, used by any means (UI, CLI, etc). You’re suggesting that depending on the way it’s invoked, it may be more thorough? I’ll have to test that next time I encounter a configuration error.

if I may ask, which app are you using?

I use the one created by @apop and I still get those anomalous “valid” config checks. All of my experiences noted above are when using it since I never use the “built-in” check config button anymore.

Here’s an example:

I added an extra “(” into the template of a template trigger:

- platform: template
  value_template: >
    {{ (states('sensor.tank_sensor_temperature') | float < 74 and states('sensor.tank_temperature_change_per_hour') | float < 0 }}

And the config checker (both built-in and the apop one - which I think still just uses the built-in one accessed in a different way) shows valid but gives me a persistent notification:

and here is the log entry:

Invalid config for [automation]: invalid template (TemplateSyntaxError: unexpected '}', expected ')') for dictionary value @ data['value_template']. Got None. (See ?, line ?).
1 Like

That’s the one. I haven’t seen any issues

Given that there’s only one API call for checking the configuration, anything designed to check the configuration will need to use the same API call. Only difference might be how it goes about presenting the results of the API call.

I need help… may be someone could help me…

I’ll transfer the following code into the new legacy…

binary_sensors:


    combined_door_windows:
      friendly_name: "Fenster/Tür Küche"
      device_class: window
      unique_id:  combined_door_windows
      value_template: >-
        {% if is_state('binary_sensor.fenster_kuche', 'on')
           or is_state('binary_sensor.tur_kuche', 'on')
           or is_state('binary_sensor.fenster_spule', 'on') %}
           on
        {% else %}
           off
        {% endif %}

But I did not know how I can do this…

You don’t need to have print statements for “on” and “off”

template:
  - binary_sensor:
      - name: "Combined Door Windows"
        device_class: window
        unique_id:  combined_door_windows
        state: >-
           {{ is_state('binary_sensor.fenster_kuche', 'on')
           or is_state('binary_sensor.tur_kuche', 'on')
           or is_state('binary_sensor.fenster_spule', 'on') }}
        attributes:
          friendly_name: "Fenster/Tür Küche"

You could also put your sensors into a group instead of using a template sensor.

1 Like

Thx a lot… now it works !!!