- platform: statistics entity_id: sensor.coronavirus_totals_normalised sampling_size: 200000 state_characteristic: mean max_age: days: 1 name: "Coronavirus Statistics" - platform: template sensors: coronavirus_totals_normalised: friendly_name: "NZ Coronavirus Totals (Normalised)" value_template: > {% set new_state = states('sensor.new_zealand_coronavirus_confirmed') | float %} {% if new_state >= states('input_number.new_zealand_coronavirus_confirmed_previous_value') | float %} {{ new_state }} {% else %} {{ states('input_number.new_zealand_coronavirus_confirmed_previous_value') | float }} {% endif %}