Calculate Utility just for a value of sensor greater than a number

Hello.
I am trying to get the gas consumption on my house heating by using a broadlink sp3s consumption.
The heater in idle is 2.75w when is recirculating water is 57w and when the gas is starting to heat is above 98w.
Now I am using

utility_meter:
  daily_energy:
    source: sensor.daily_energy
    cycle: daily
  - platform: template
    sensors:
      daily_energy:
        friendly_name: Daily Energy
        unit_of_measurement: KW
        value_template: "{{ states('sensor.instant_energy')|  float * 0.001  | round(4)) }}"

But this will give me all the consumption daily.
I need to calculate the daily for everything above 98 of sensor.instant_energy.

Any help is much appreciated.

Not sure how that configuration works for you. It’s not valid yaml. If you want to take instantaneous energy and convert it to Wh or kWh, then you’d need to use the integration integration. Then use that sensor for utility meter.

I use the template just for KW conversion

Yes but what you posted is not valid, so you either copy/pasted the code blocks from 2 sections of your code or it’s doing nothing and you think its doing something.

this is my first topic and is hush hush with the text formatting.

My code is long , and the utility is working fine.

I just want to count values greater than 98 in Utility for that sensor

Make a template binary_sensor.

binary_sensor:
  - platform: template
    sensors:
      above_98:
        value_template: "{{ states('sensor.instant_energy')|  float > 98 }}"

Then use the history stats sensor to count the number of times on over the past day.

sensor:
  - platform: history_stats
    name: Above 98 Today
    entity_id: binary_sensor.above_98
    state: 'on'
    type: count
    start: '{{ now().replace(hour=0, minute=0, second=0) }}'
    end: '{{ now() }}'

If its about the template, an example:

        value_template: >
          {% set value = states('input_number.temp_test') | float %}
          {{ value if value > 98 else 0 }}

great!
thank you
after the sensor will populate I will tell you the results