Inital Commit
This commit is contained in:
35
packages/covid_count.yaml
Normal file
35
packages/covid_count.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
var:
|
||||
covid_daily:
|
||||
friendly_name: "Daily Covid count"
|
||||
initial_value: 0
|
||||
icon: mdi:virus-outline
|
||||
covid_yesterday_total:
|
||||
friendly_name: "Yesterdays NZ Cumulative Total Covid Cases"
|
||||
initial_value: 0
|
||||
icon: mdi:virus-outline
|
||||
|
||||
automation:
|
||||
- id: add_covid_confirmed_stats_only_if_increases
|
||||
alias: add_covid_confirmed_stats_only_if_increases
|
||||
#description:
|
||||
# "Check new state of sensor.new_zealand_coronavirus_confirmed and store it
|
||||
# in input_number.new_zealand_coronavirus_confirmed_previous_value if it has increased"
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.new_zealand_coronavirus_confirmed
|
||||
condition:
|
||||
- condition: template
|
||||
value_template:
|
||||
"{{ (states('sensor.new_zealand_coronavirus_confirmed') | float
|
||||
> states('var.covid_yesterday_total') | float) }}"
|
||||
action:
|
||||
- service: var.set
|
||||
data_template:
|
||||
entity_id: var.covid_daily
|
||||
value:
|
||||
"{{ states('sensor.new_zealand_coronavirus_confirmed') | float - states('var.covid_yesterday_total')
|
||||
| float }}"
|
||||
- service: var.set
|
||||
data_template:
|
||||
entity_id: var.covid_yesterday_total
|
||||
value: "{{ states('sensor.new_zealand_coronavirus_confirmed') | float }}"
|
Reference in New Issue
Block a user