Trying to track the number of AC is on using temperature sensor

I am trying to track the number of half-hours the AC is on for the day.

Can i use state to detect if it’s below 15 to record the history_stats counter?

Below is my code if needed. Thanks!

sensor:
  - platform: history_stats
    name: below_15c_counter
    entity_id: sensor.masterroomac_temp_temperature
    state: "below 15"
    type: time
    end: "{{ now().replace(hour=0, minute=0, second=0, microsecond=0) }}"
    duration:
      hours: 24
    duration: "00:30"