Hide entity if last event was longer than 60 min ago

Hey,

I like to use various entities in the titles of the cards to represent events. These include entities that are only displayed when important things happen.
Battery indicator, for example, only when less than 10% capacity is available. Or the vibration sensor only when there is a knock. And so on.

Now I would like to display the doorbell only if someone has rung the doorbell within the last hour.
This doesn’t seem to work with normal conditions.

Sorry, the screenshot is in German, but I think it should illustrate what I mean.
Can anyone help me?

Many thanks!

You will have to create a template binary sensor that checks the last_changed property of your doorbell.

e.g.

template:
  - binary_sensor:
      - name: Doorbell Changed Within 1 Hour
        state: "{{ now() - states.binary_sensor.doorbell_button.last_changed < timedelta(hours=1) }}"

You can then hide the card if this binary sensor is off.

1 Like

Thanks! It works like a charm!