Error message every minute

best to replace
{{ states.device.domain.attributes.attr }}
with
{{ state_attr("device.domain", "attr") }}

In Developer Tools -> Registry I see this:

Does “helpers/condition.py (ERROR)” give a hint?
Does it mean that the problem is inside a condition in my yaml files, or maybe it could be a problem in some custom component?

what is the device that you’re after and what is the attribute name?

I don’t know, I didn’t understand what is causing the error, I’m looking for help in finding it.

if you don’t know which device you need info from, I’m not sure anyone can help…
The error message occurs because your code is wrong and HA doesn’t know what you’re trying to do…
you probably have an automation or a template sensor somewhere with incorrect data OR one of your sensors is unavailable and therefore has no attributes…

The error is going to be in a automation condition. So filter your search to all automation condition templates.

I did that, I will try again to see what I missed yesterday…

It’s also going to be an automation that fires once a minute. So something thats based on sensor.time or a time_pattern trigger.

Also, it’s pointing to incorrect syntax in general. It’s saying you are trying to access attributes from attributes. I.e. it’s implying you’re doing the equivalent of states.domain.object_id.attributes.attributes.

I checked all my automation related to time, I will double check. Thanks also for the other suggestion.

Nothing.
I will give it another shot at home.
Isn’t there any way to use the logger to understand where the problem is?

can you just post all your automations with a condition template?

I rechecked all my yaml files.
I found only 2 automation with a template condition, they are the 2 HACS automation:

- id: 'automation hacs_updates'
  alias: Create a notification when there is updates pending in HACS
  trigger:
    platform: state
    entity_id: sensor.hacs
  condition:
    - condition: template
      value_template: "{{ states(trigger.entity_id) != 'unknown'}}"
    - condition: template
      value_template: "{{ (states(trigger.entity_id) | float) != 0}}"
  action:
    service: persistent_notification.create
    data_template:
      title: Updates pending in HACS
      message: >-
        {% for repo in state_attr(trigger.entity_id, 'repositories') %}
          **{{ repo.display_name }}** _{{ repo["installed version"] }}_ -> _{{ repo["available version"] }}_
        {% endfor %}
          
- id: 'automation hacs_new_repo'
  alias: Create a notification when somethig is added to HACS
  trigger:
    platform: event
    event_type: hacs/repository
    event_data:
      action: registration
  condition:
    condition: template
    value_template: "{{ trigger.event.data.repository is defined }}"
  action:
    service: persistent_notification.create
    data_template:
      title: New repository in HACS
      message: >-
        {% set repo = trigger.event.data.repository %}
        {% set id = trigger.event.data.repository_id %}
        [{{ repo }}](/hacs/repository/{{ id }})
        was just added to HACS.

Then I have a couple of automation that in condition have a templated sensor:

- alias: Notifica che occorre aprire la finestra Alex&May
    initial_state: 'on'
    trigger: 
      - platform: state
        entity_id: input_boolean.altaumidita_alexmay
        to: 'on'
    condition:
      - condition: numeric_state
        entity_id: sensor.umidita_esterna
        below: 85
    action:
      - service: script.notifiche_muffa_telegram
        data_template:
          titolo: '**Aria Alex & May KO**'
          messaggio: 'Il valore di umidità nella camera da letto di Alex & May è troppo elevato. Si consiglia di aprire la finestra per arieggiare.'
      - service: script.notifiche_muffa_vocali
        data:
          messaggio: 'Il valore di umidità nella camera da letto di Alex & May è troppo elevato. Si consiglia di aprire la finestra per arieggiare.'

the above sensor is defined like this:

sensor:
  - platform: template
    sensors:
      umidita_esterna:
        friendly_name: "UmiditĂ  esterna"
        unit_of_measurement: '%'
        value_template: "{{(states('sensor.dark_sky_humidity'))|int}}"

I must be missing something… I understood that the problem must be in an automation that gets triggered every minute and that has a template in the condition, but I can’t find an automation like that in my configuration. :frowning:

I found it!!!
The template giving the problem was not in condition, it was in trigger of this automation:

  - alias: telegram_chiudi_auto_sezionale
    trigger:
      - platform: template
        value_template: "{{ states('sensor.time') == ( states.input_datetime.orario_chiusura.attributes.timestamp | int + 900 ) | timestamp_custom('%H:%M', False) }}"
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: binary_sensor.contatto_open_close_2
          state: 'on'
        - condition: state
          entity_id: input_boolean.chiusura_automatica
          state: 'on'
    action:
      - service: notify.alex
        data:
          message: Hai dimenticato di chiudere il BOX, lo sto chiudendo io per te.
          title: '*Chiusura BOX in corso*'
      - service: script.chiudi_sezionale
      - service: telegram_bot.delete_message
        data_template:
          message_id: '{{ trigger.event.data.message.message_id }}'
          chat_id: '{{ trigger.event.data.chat_id }}'
      - service: media_player.volume_set
        data_template:
          entity_id: media_player.googlehomemini
          volume_level: 0.8
      - service: tts.google_say
        entity_id: media_player.googlehomemini
        data_template:
          message: 'Ho chiuso il box in automatico'
          language: 'it'

By commenting the automation, the error popping up every minute finally stopped.
Now I have to fix this row:

value_template: "{{ states('sensor.time') == ( states.input_datetime.orario_chiusura.attributes.timestamp | int + 900 ) | timestamp_custom('%H:%M', False) }}"

First, I have not clear when I have to use single or double quotes, but even changing them to single the result is the same, so that’s not the problem.

Try evaluating the template a bit at a time in the template editor - that will help you find the error.

I’m not sure, but maybe I fixed it, I must check if it works.
Recently I added a dropdown list with different hour values available for the automatic garage door closing, but I forgot to update the trigger, and since in winter I usually don’t leave the garage door opened, I didn’t notice that it was not working.

Now I changed

value_template: "{{ states('sensor.time') == ( states.input_datetime.orario_chiusura.attributes.timestamp | int + 900 ) | timestamp_custom('%H:%M', False) }}"

to

value_template: "{{ states('sensor.time') == ( states.input_select.orario_chiusura.state | int + 900 ) | timestamp_custom('%H:%M', False) }}"

The template editor shows value_template: “False”, so it should be, FINALLY, ok.

Can I ask a little more help, even if it’s going a little OT?

{{states.input_select.orario_chiusura.state == states.sensor.time.state}}
is working ok in order to check if current time is equal to the time in the input_select field.

I need a second trigger 15 minutes later.
{{ ( states.input_select.orario_chiusura.state | int + 900 ) == states.sensor.time.state}}
is not working, while it was working when I was using the input_datetime showed in the previous post.

Can someone help me with the correct syntax?