Files
zorruno-homeassistant/sensor/coronavirus.yaml
2022-10-11 15:40:40 +13:00

19 lines
691 B
YAML

- 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 %}