Count each time the temperature rises above 30 degrees

Hello
Is there anyone who can help me?

Calculate the number of times the temperature rises above 30 degrees in a
counter

Device name
sensor.temp_4
feed a counter

can i use Statistics Sensor ?

# enable the recorder integration (optional)
recorder:

# Example configuration.yaml entry
sensor:
  - platform: statistics
    entity_id: sensor.temp_4
    name: "Eldat"
 

best regards

or…how about using a counter…?

2 Likes

Thanks @finity
I think I create one Template Binary Sensor

binary_sensor:
  - platform: template
    sensors:
      furnace_on:
        friendly_name: "Temp above 30"
        device_class: heat
        value_template: "{{ states('sensor.temp4')|float > 30 }}"

and a counter

counter:
  my_custom_counter:
    initial: 30
    step: 1
    name: "test 3"
    icon: mdi:alert

I can create several ?

counter:
  my_custom_counter:
    initial: 30
    step: 1
    name: "test 3"
    icon: mdi:alert
  error_counter:
    name: Errors
    icon: mdi:alert

Finally an automation that counts the number of times the sensor changes the value to on

Is there anyone who can help a novice
Best regards