Automation for notification on room temperature changes and without repeat notifications

so i was working on an automation where i have a temp sensor in my office and wanted to know when it got past 90 F (use whatever unit or value you want in this) started using C.A.F.E to build it but quickly realized i didnt know enough. so i asked chatgpt to help me with the automation and here is what it came up with and what i am using. change sensor and boolean names to what you use and setup

alias: extreme Heat Detect
description: ''
triggers:
  - trigger: time_pattern
    hours: /1
conditions: []
actions:
  - if:
      - condition: numeric_state
        entity_id: sensor.office_temperature_temperature
        above: 90
      - condition: state
        entity_id: input_boolean.temperature_warning
        state: 'off'
    then:
      - if:
          - condition: time
            after: '09:00:00'
            before: '21:00:00'
        then:
          - data:
              title: Office Temperature
              message: Office temperature is above 90°F.
            action: script.notify_robert
        else:
          - data:
              level: warning
              message: Office temperature is above 90°F during quiet hours.
            action: system_log.write
      - target:
          entity_id: input_boolean.temperature_warning
        action: input_boolean.turn_on
      - target:
          entity_id:
            - input_boolean.temperature_reasonable
            - input_boolean.temperature_cold
        action: input_boolean.turn_off
    else:
      - if:
          - condition: numeric_state
            entity_id: sensor.office_temperature_temperature
            below: 89
          - condition: state
            entity_id: input_boolean.temperature_cold
            state: 'off'
        then:
          - if:
              - condition: time
                after: '09:00:00'
                before: '21:00:00'
            then:
              - data:
                  title: Office Temperature
                  message: Office temperature is below 89°F.
                action: script.notify_robert
            else:
              - data:
                  level: warning
                  message: Office temperature is below 89°F during quiet hours.
                action: system_log.write
          - target:
              entity_id: input_boolean.temperature_cold
            action: input_boolean.turn_on
          - target:
              entity_id:
                - input_boolean.temperature_warning
                - input_boolean.temperature_reasonable
            action: input_boolean.turn_off
        else:
          - if:
              - condition: numeric_state
                entity_id: sensor.office_temperature_temperature
                above: 88.99
              - condition: numeric_state
                entity_id: sensor.office_temperature_temperature
                below: 90.01
              - condition: state
                entity_id: input_boolean.temperature_reasonable
                state: 'off'
            then:
              - if:
                  - condition: time
                    after: '09:00:00'
                    before: '21:00:00'
                then:
                  - data:
                      title: Office Temperature
                      message: Office temperature is between 89°F and 90°F.
                    action: script.notify_robert
                else:
                  - data:
                      level: warning
                      message: >-
                        Office temperature is between 89°F and 90°F during quiet
                        hours.
                    action: system_log.write
              - target:
                  entity_id: input_boolean.temperature_reasonable
                action: input_boolean.turn_on
              - target:
                  entity_id:
                    - input_boolean.temperature_warning
                    - input_boolean.temperature_cold
                action: input_boolean.turn_off
            else: []
mode: single


I am using a sonoff snzb-02p as the sensor and you can change the times this is just what i am using hope it helps somebody trying to do something similar Also to allow the automation to write and display in the system log you need to add

logger:
  default: warning
  logs:
    homeassistant.components.system_log.external: warning

to the top of your configuration.yaml otherwise they dont show in the log