Help me with - Error rendering template: UndefinedError: 'mappingproxy object' has no attribute 'timestamp'

Hi, I have problem with that:

“{{ states(‘sensor.time’) == (states.input_datetime.retic_program1_start_time_1.attributes.timestamp | int | timestamp_custom(‘%H:%M’, False)) }}”

Error rendering template: UndefinedError: ‘mappingproxy object’ has no attribute ‘timestamp’

Ca you help me?

Thank you

Tomas

First, try and format your code, else it can’t be copied without error:

Now assuming the state of sensor.time and the attribute timestamp from input_datetime.retic_program1_start_time_1.attributes give you a date time style date (e.g. yyyy-mm-dd hh:mm:ss), you can use this:
'{{as_timestamp(states("sensor.time")) == as_timestamp(state_attr("input_datetime.retic_program1_start_time_1", "timestamp"))}}'

I think your example may include something from your own system. It references input_datetime.holiday_start which is not mentioned in Tomas’ post. I believe you meant to use sensor.time in the left hand side of the equation.

thanks, was using my own stuff for testing indeed.
now updated :wink:

HI thank you, for your answer, but isn´t working, now I have this error:

Error loading /config/configuration.yaml: while parsing a block mapping
  in "/config/automation/irrigation (1).yaml", line 33, column 9
expected <block end>, but found '<scalar>'
  in "/config/automation/irrigation (1).yaml", line 35, column 49

My automation trigger is:

trigger:

  • platform: template
    value_template: “{{as_timestamp(states(“sensor.time”)) == as_timestamp(state_attr(“input_datetime.retic_program1_start_time_2”, “timestamp”))}}”

Thank you

T.

You can’t use " " on the outside and inside of the template. Try using ’ ’ inside

that´s it… thank you

I am having suddenly problems with these templates:

          {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[0] and states.calendar.mauriziofabianigmailcom.attributes.all_day != True %} Prossimo appuntamento in Agenda: {{states.calendar.mauriziofabianigmailcom.attributes.message}} at {{(states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[1].split(":")[0]}} {%if (states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[1].split(":")[1] != '00'%}{{(states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[1].split(":")[1]}} {%endif%} {%endif%}
          {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[0] and states.calendar.mauriziofabianigmailcom.attributes.all_day == True %} Oggi è: {{states.calendar.mauriziofabianigmailcom.attributes.message|replace("/","and")}}{%endif%}
          {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.inter_calendar.attributes.start_time).split(" ")[0] and states.calendar.inter_calendar.attributes.all_day != True %} Prossimo appuntamento in agenda: {{states.calendar.inter_calendar.attributes.message}} alle {{(states.calendar.inter_calendar.attributes.start_time).split(" ")[1].split(":")[0]}} {%if (states.calendar.inter_calendar.attributes.start_time).split(" ")[1].split(":")[1] != '00'%}{{(states.calendar.inter_calendar.attributes.start_time).split(" ")[1].split(":")[1]}} {%endif%} {%endif%}
          {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.inter_calendar.attributes.start_time).split(" ")[0] and states.calendar.inter_calendar.attributes.all_day == True %} Oggi è: {{states.calendar.inter_calendar.attributes.message|replace("/","and")}}{%endif%}
          {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.contacts.attributes.start_time).split(" ")[0] and states.calendar.contacts.attributes.all_day != True %} Prossimo appuntamento in agenda: {{states.calendar.contacts.attributes.message}} alle {{(states.calendar.contacts.attributes.start_time).split(" ")[1].split(":")[0]}} {%if (states.calendar.contacts.attributes.start_time).split(" ")[1].split(":")[1] != '00'%}{{(states.calendar.contacts.start_time).split(" ")[1].split(":")[1]}} {%endif%} {%endif%}
          {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.contacts.attributes.start_time).split(" ")[0] and states.calendar.contacts.attributes.all_day == True %} Oggi è: {{states.calendar.contacts.attributes.message|replace("/","and")}}{%endif%}
          Tempo di percorrenza per Roma {{ states.sensor.avezzano_roma.attributes.duration | int | round(0) }} Minuti         

And the error i get is the following:

Error rendering template: UndefinedError: 'mappingproxy object' has no attribute 'start_time'

Where is the error?