Skip to content

Commit

Permalink
Merge pull request #32 from caiosweet/dev
Browse files Browse the repository at this point in the history
Migration For old sensor/binary sensor configuration format to Integration Template
  • Loading branch information
caiosweet authored Aug 8, 2021
2 parents 544cf82 + aaf87a7 commit d1582f2
Show file tree
Hide file tree
Showing 3 changed files with 320 additions and 372 deletions.
55 changes: 18 additions & 37 deletions config/lovelace/cards/card_natural_events_light.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,20 @@ cards:
type: divider
# sort:
# method: entity_id
unique: entity
filter:
exclude:
- entity_id: "binary_sensor.global_natural_alert"
# - entity_id: 'binary_sensor.shakemap'
include:
- entity_id: sensor.*
# state: ">1"
attributes:
integration: dpc
total_alerts: ">0"
or:
- attributes:
integration: dpc
total_phenomena: ">0"
- attributes:
integration: dpc
total_alerts: ">0"
options:
entity: this.entity_id
secondary_info: last-updated
Expand All @@ -296,7 +300,6 @@ cards:
color: var(--color);
--paper-item-icon-color: var(--paper-item-icon-active-color); ##var(--color);
}
- entity_id: "binary_sensor.*"
state: "on"
attributes:
Expand Down Expand Up @@ -394,37 +397,15 @@ cards:
show_empty: false
filter:
include:
- entity_id: binary_sensor.*
state: "on"
attributes:
integration: dpc
- entity_id: sensor.*
# state: ">0"
attributes:
integration: dpc
total_alerts: ">0"
or:
- attributes:
integration: dpc
total_phenomena: ">0"
- attributes:
integration: dpc
total_alerts: ">0"
card:
# type: markdown
# # entity_id: this.entity_id
# card_mod:
# style: |
# ha-card {background: none; border-radius: 0px; box-shadow: none;}
# content: >
# ___

# #### PROTEZIONE CIVILE

# {% set color = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red'} %}
# {% for state in states.binary_sensor %}
# {% if is_state_attr(state.entity_id, 'integration', 'dpc') and state.state == 'on' %}

# <font color= {{color[state.attributes.level|int]}}> <ha-icon icon="{{ 'mdi:numeric-' ~ state.attributes.level|int ~ '-box'}}" style="width: 36px; height: 36px;"></ha-icon>
# {{state.name}} - {{state.attributes.alert}} {{state.attributes.info}}</font>
# {% endif %} {% endfor %}

# [Protezione Civile](https://www.protezionecivile.gov.it/it/) ~ [Vigilanza Meteo](https://mappe.protezionecivile.it/it/mappe-rischi/bollettino-di-vigilanza)
# ~ [Criticità Idro](https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita) ~ [Radar](https://mappe.protezionecivile.it/it/mappe-rischi/piattaforma-radar)

#################################################################
## DPC SENSOR CRITICITA - VIGILANZA
#################################################################
Expand Down Expand Up @@ -484,7 +465,7 @@ cards:
{% set v = state_attr(entity, status) %}
{%- if v %}
{%- if v['level'] >= 1 %}
<font color="{{ color_v.get(v['level']) }}"/> <ha-icon icon="{{ v['icon'] }}"/></ha-icon> {{ day[status] }} Quantitativi previsti {{ v['precipitation'] }} </font>
<font color="{{ color.get(v['level']) }}"/> <ha-icon icon="{{ v['icon'] }}"/></ha-icon> {{ day[status] }} Quantitativi previsti {{ v['precipitation'] }} </font>
{%- endif %}
{%- if v.phenomena %}
{% for d in v.phenomena %}
Expand Down Expand Up @@ -839,7 +820,7 @@ cards:
entities:
- sensor.date
card:
type: custom:hui-iframe-card
type: iframe #custom:hui-iframe-card
card_mod:
style: |
ha-card {
Expand All @@ -864,7 +845,7 @@ cards:
entities:
- sensor.date
card:
type: custom:hui-iframe-card
type: iframe #custom:hui-iframe-card
card_mod:
style: |
ha-card {
Expand Down
42 changes: 10 additions & 32 deletions config/lovelace/cards/card_natural_events_picture_menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -524,37 +524,15 @@ cards:
show_empty: false
filter:
include:
- entity_id: binary_sensor.*
state: "on"
attributes:
integration: dpc
- entity_id: sensor.*
# state: ">0"
attributes:
integration: dpc
total_alerts: ">0"
or:
- attributes:
integration: dpc
total_phenomena: ">0"
- attributes:
integration: dpc
total_alerts: ">0"
card:
# type: markdown
# # entity_id: this.entity_id
# card_mod:
# style: |
# ha-card {background: none; border-radius: 0px; box-shadow: none;}
# content: >
# ___

# #### PROTEZIONE CIVILE

# {% set color = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red'} %}
# {% for state in states.binary_sensor %}
# {% if is_state_attr(state.entity_id, 'integration', 'dpc') and state.state == 'on' %}

# <font color= {{color[state.attributes.level|int]}}> <ha-icon icon="{{ 'mdi:numeric-' ~ state.attributes.level|int ~ '-box'}}" style="width: 36px; height: 36px;"></ha-icon>
# {{state.name}} - {{state.attributes.alert}} {{state.attributes.info}}</font>
# {% endif %} {% endfor %}

# [Protezione Civile](https://www.protezionecivile.gov.it/it/) ~ [Vigilanza Meteo](https://mappe.protezionecivile.it/it/mappe-rischi/bollettino-di-vigilanza)
# ~ [Criticità Idro](https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita) ~ [Radar](https://mappe.protezionecivile.it/it/mappe-rischi/piattaforma-radar)

#################################################################
## DPC SENSOR CRITICITA - VIGILANZA
#################################################################
Expand Down Expand Up @@ -614,7 +592,7 @@ cards:
{% set v = state_attr(entity, status) %}
{%- if v %}
{%- if v['level'] >= 1 %}
<font color="{{ color_v.get(v['level']) }}"/> <ha-icon icon="{{ v['icon'] }}"/></ha-icon> {{ day[status] }} Quantitativi previsti {{ v['precipitation'] }} </font>
<font color="{{ color.get(v['level']) }}"/> <ha-icon icon="{{ v['icon'] }}"/></ha-icon> {{ day[status] }} Quantitativi previsti {{ v['precipitation'] }} </font>
{%- endif %}
{%- if v.phenomena %}
{% for d in v.phenomena %}
Expand Down Expand Up @@ -969,7 +947,7 @@ cards:
entities:
- sensor.date
card:
type: custom:hui-iframe-card
type: iframe #custom:hui-iframe-card
card_mod:
style: |
ha-card {
Expand All @@ -994,7 +972,7 @@ cards:
entities:
- sensor.date
card:
type: custom:hui-iframe-card
type: iframe #custom:hui-iframe-card
card_mod:
style: |
ha-card {
Expand Down
Loading

0 comments on commit d1582f2

Please sign in to comment.