Limit times a template sensor updates

This is probably a very basic thing, but I just can’t figure it out. I have a very basic sensor to turn an attribute into a sensor that I can use in my dashboard. But the attribute seems to update every few seconds switching between temperatures (say 19.5 to 20 back to 19.5 back to 20, etc). Which is total overkill. As such I would like to limit the times the sensor actually updates its value.

How can I limit this floor heating temperature sensor to say only check and update every 15 minutes?

sensor:
  - platform: template
    sensors:
      bathroom_floor_temperature:
        friendly_name: "Bathroom Floor temperature"
        unique_id: "Bathroom_floor_temperature"
        value_template: "{{ state_attr('climate.vloerverwarming_badkamer', 'current_temperature') }}"
      

Replace it with this (in your configuration.yaml file):

template:
  - trigger:
      - platform: time_pattern
        minutes: "/15"
    unique_id: "Bathroom_floor_temperature"
    sensor:
      - name: "Bathroom Floor temperature"
        state: "{{ state_attr('climate.vloerverwarming_badkamer', 'current_temperature') }}"
        unit_of_measurement: "°C"
        device_class: temperature
        state_class: measurement
4 Likes

Thanks! Going to try it out right now.

Starting to get results on timed interval now instead of every few seconds. Thank you!

@tom_l Thank you for this. I was looking at ways to reduce the data load.

I assume this would reduce the number of data points recorded in the Recorder and database. (I know one sensor won’t make a huge difference but…)

Does the line:
unique_id: "Bathroom_floor_temperature"
actually create a unique ID? It doesn’t seem to for me.