Home Assistant Community

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

Tags: #<Tag:0x00007fcf5371ceb8>

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



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:


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

Thank you



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


that´s it… thank you