Installed latest beta and some warnings

Hi i installed the beta 2024.8.3 and saw some warnings that appear a lot, hundreds of times
Can somebody give me a hint what this is and where to look to solve it, no clue,

this warning i get 100+

2024-08-29 17:19:08.031 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'event' when rendering '{{trigger.event}}'
2024-08-29 17:19:08.032 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'offset' when rendering '{{trigger.offset}}'
2024-08-29 17:19:50.102 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'event' when rendering '{{trigger.event}}'
2024-08-29 17:19:50.103 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'offset' when rendering '{{trigger.offset}}'
2024-08-29 17:19:50.160 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'event' when rendering '{{trigger.event}}'
2024-08-29 17:19:50.160 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'offset' when rendering '{{trigger.offset}}'
2024-08-29 17:22:26.376 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'event' when rendering '{{trigger.event}}'
2024-08-29 17:22:26.378 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'offset' when rendering '{{trigger.offset}}'
2024-08-29 17:24:08.027 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'event' when rendering '{{trigger.event}}'
2024-08-29 17:24:08.028 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'offset' when rendering '{{trigger.offset}}'


First of all, the version you mention is not a beta, but a stable patch release. Second, it looks like you created a wrong template somewhere. It is not a very bad error, but the sensor or automation using it isn’t working as expected.

It looks like the template are meant for an automation that was triggered by an event, and an automation that uses an offset for the trigger. If you use those templates in any other context than where they are meant for, they will produce errors like these. The error seems to refer to helpers, did you by any chance create helper sensors in the gui with templates like these in them? Helpers have no trigger, so they would certainly give errors like these. Unless it is a trigger based template sensor, but you can only create those in yaml.

The errors were probably there before too, they have no relation to the update.

OK, thanks!
Still a newbie with Hass, and dont look much in the logfiles.
i have different yaml files.
One that containts integrations and one with sensors.
Is there an approach how to find it, the warning does not say much…

Is a way to solve it

  1. by disabling the complete yaml file in de configuration.yaml
    and when i find the yaml file that gives the warning
    disable the parts within the yaml?

two of my yamls


- platform: integration
  source: sensor.Energielevering
  name: Energielevering2
  unique_id: Energielevering2
  method: left
  unit_prefix: k
  round: 2
#
- platform: integration
  source: sensor.Energielevering
  name: Energielevering3
  unique_id: Energielevering3
  method: left
  unit_prefix: k
  round: 2
#
- platform: integration
  source: sensor.Energieafname
  name: Energieafname2
  unique_id: Energieafname2
  method: left
  unit_prefix: k
  round: 2
#
# Minimal configuration of the standard time and date sensor
- platform: time_date
  display_options:
    - 'date_time_iso'

or

# Build on the standard sensor to produce one that can be customized
- sensor:
  - name: "Date and time"
    state: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B %-d, %I:%M %p') }}"
    icon: "mdi:calendar-clock"

#
# van een attribute een sensor maken zodat ik t in een glancecard kan opnemen
#

- sensor:
  - name: "wasmelding"
    icon: mdi:washing-machine
    state: >
      {{ state_attr("sensor.melding", "wasmachine_status" ) }}

#
# energie
#
  - name: "netlevering_totaal"
    unique_id: netlevering_totaal
    unit_of_measurement: "kWh"
    device_class: energy
    state: >
      {{ (states('sensor.energy_delivery_low')|float(0) +
         states('sensor.energy_delivery_high')|float(0))   }}      
    availability: >
      {{ states('sensor.energy_delivery_low') | is_number and
         states('sensor.energy_delivery_high') | is_number }}
  - name: "Energieafname"
    unique_id: Energieafname
    unit_of_measurement: "W"
    device_class: power
    state: >
      {% set grid_out = states('sensor.power_usage') | float(0) %}
      {% if grid_out > 0 %}
        {{ grid_out }}
      {% else %}
        0
      {% endif %}
#
# 
#
  - name: "Energielevering"
    unique_id: Energielevering
    unit_of_measurement: "W"
    device_class: power
    state: >
      {% set grid_out = states('sensor.power_usage') | float(0) %}
      {% if grid_out < 0 %}
        {{ grid_out | abs }}
      {% else %}
        0
      {% endif %}```

the problematic template is litterally:

{{trigger.event}}

or:

{{trigger.offset}}

So you can seach yaml files for those specific texts. But if you created helper sensors in the GUI they are not in those yaml files, you find and fix those in the gui as well. If you find then in automations.yaml they might be right, you’d have to examine the automation to see if they are correct.

It could also be they were in an automation that worked perfectly, until you added an extra trigger to the automation that is not for an event or has no offset.

Last but not least, if you used a blueprint from some one, there might be a bug in that. But the creator of the blueprint should fix that.

1 Like

ok, that looks like a lot of search work :slight_smile:
But your info helps a lot.
Pitty that the warnings in the log do not give more info to look at the exact place…

Tools like Studio Code have file search…

Events are most commonly used for automations reacting on buttons, maybe that helps? Or the fact it seems to look for a delay?

and can the warning time also be used, for example to match with the last execution time of the automation?

No, not likely. Something with looking for calendar events maybe? Or something waiting for a timer to finish?