Skip to content

History

Showing with 25 additions and 50 deletions.
  1. +0 −3 ApexChartsTodayDailyValues.md
  2. +0 −2 ApexChartsTodayHourlyValues.md
  3. +8 −14 Coopérnico-Base-Bi-horário.md
  4. +5 −11 Coopérnico-Base-Simples.md
  5. +6 −10 Luzboa-SPOT-BTN-Bi-horário.md
  6. +6 −10 Luzboa-SPOT-BTN-Simples.md
3 changes: 0 additions & 3 deletions ApexChartsTodayDailyValues.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ series:
- entity: sensor.omie_spot_price_pt
attribute: today_average
name: Daily price
- entity: sensor.omie_adjustment_price_pt
attribute: today_average
name: Daily adjustment
yaxis:
- id: price
align_to: 10
Expand Down
2 changes: 0 additions & 2 deletions ApexChartsTodayHourlyValues.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ all_series_config:
series:
- entity: sensor.omie_spot_price_pt
name: Hourly price
- entity: sensor.omie_adjustment_price_pt
name: Hourly adjustment
yaxis:
- id: price
align_to: 10
Expand Down
22 changes: 8 additions & 14 deletions Coopérnico-Base-Bi-horário.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ template:
state_class: measurement
state: >
{% set PM = states('sensor.omie_spot_price_pt')|float -%}
{% set MAJ = states('sensor.omie_adjustment_price_pt')|float(0) -%}
{% set CGS = 4 -%}
{% set k = 10 -%}
{% set FP = 0.15 -%}
{% set TAR_vazio = 9.2 -%}
{% set TAR_fora_vazio = 50.2 -%}
{% set TAR = TAR_vazio if now().hour < 8 or now().hour > 21 else TAR_fora_vazio -%}
{{ ((PM + CGS + k)*(1 + FP) + MAJ + TAR) | round(2) }}
{{ ((PM + CGS + k)*(1 + FP) + TAR) | round(2) }}
attributes:
friendly_name: "Coopérnico Base (tarifário bi-horário)"
formula: "(PM+CGS+K)*(1+FP)+MIBEL+TAR"
formula: "(PM+CGS+K)*(1+FP)+TAR"
PM: "{{ states('sensor.omie_spot_price_pt')|float }}"
MIBEL: "{{ states('sensor.omie_adjustment_price_pt')|float(None) }}"
CGS: "{{ 4 | float }}"
k: "{{ 10 | float }}"
FP: "{{ 0.15 | float }}"
Expand All @@ -38,14 +36,12 @@ template:
{% set TAR_fora_vazio = 50.2 -%}
{% set ns = namespace(hourly_data=[]) %}
{% for h, PM in state_attr('sensor.omie_spot_price_pt', 'today_hours').items() -%}
{% set MAJ = state_attr('sensor.omie_adjustment_price_pt', 'today_hours').get(h, None) | float(0) -%}
{% set TAR = TAR_vazio if h.hour < 8 or h.hour > 21 else TAR_fora_vazio -%}
{% for h, PM in state_attr('sensor.omie_spot_price_pt', 'today_hours').items() -%}
{% if PM == None %}
{% set price=PM %}
{% else %}
{% set price=((PM + CGS + k)*(1 + FP) + MAJ + TAR) | round(2) %}
{% set TAR = TAR_vazio if h.hour < 8 or h.hour > 21 else TAR_fora_vazio -%}
{% set price=((PM + CGS + k)*(1 + FP) + TAR) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
{% endfor -%}
Expand All @@ -59,13 +55,11 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h, PM in state_attr('sensor.omie_spot_price_pt', 'tomorrow_hours').items() -%}
{% set MAJ = state_attr('sensor.omie_adjustment_price_pt', 'tomorrow_hours').get(h, None) | float(0) -%}
{% set TAR = TAR_vazio if h.hour < 8 or h.hour > 21 else TAR_fora_vazio -%}
{% if PM == None or MAJ == None %}
{% if PM == None %}
{% set price=PM %}
{% else %}
{% set price=((PM + CGS + k)*(1 + FP) + MAJ + TAR) | round(2) %}
{% set TAR = TAR_vazio if h.hour < 8 or h.hour > 21 else TAR_fora_vazio -%}
{% set price=((PM + CGS + k)*(1 + FP) + TAR) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
{% endfor -%}
Expand Down
16 changes: 5 additions & 11 deletions Coopérnico-Base-Simples.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ template:
state_class: measurement
state: >
{% set PM = states('sensor.omie_spot_price_pt')|float -%}
{% set MAJ = states('sensor.omie_adjustment_price_pt')|float(0) -%}
{% set CGS = 4 -%}
{% set k = 10 -%}
{% set FP = 0.15 -%}
{% set TAR = 36.5 -%}
{{ ((PM + CGS + k)*(1 + FP) + MAJ + TAR) | round(2) }}
{{ ((PM + CGS + k)*(1 + FP) + TAR) | round(2) }}
attributes:
friendly_name: "Coopérnico Base (tarifário simples)"
formula: "(PM+CGS+K)*(1+FP)+MIBEL+TAR"
formula: "(PM+CGS+K)*(1+FP)+TAR"
PM: "{{ states('sensor.omie_spot_price_pt')|float }}"
MIBEL: "{{ states('sensor.omie_adjustment_price_pt')|float(None) }}"
CGS: "{{ 4 }}"
k: "{{ 10 }}"
FP: "{{ 0.15 }}"
Expand All @@ -35,12 +33,10 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h, PM in state_attr('sensor.omie_spot_price_pt', 'today_hours').items() -%}
{% set MAJ = state_attr('sensor.omie_adjustment_price_pt', 'today_hours').get(h, None) | float(0) -%}
{% if PM == None %}
{% set price=PM %}
{% else %}
{% set price=((PM + CGS + k)*(1 + FP) + MAJ + TAR) | round(2) %}
{% set price=((PM + CGS + k)*(1 + FP) + TAR) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
{% endfor -%}
Expand All @@ -53,12 +49,10 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h, PM in state_attr('sensor.omie_spot_price_pt', 'tomorrow_hours').items() -%}
{% set MAJ = state_attr('sensor.omie_adjustment_price_pt', 'tomorrow_hours').get(h, None) | float(0) -%}
{% if PM == None or MAJ == None %}
{% if PM == None %}
{% set price=PM %}
{% else %}
{% set price=((PM + CGS + k)*(1 + FP) + MAJ + TAR) | round(2) %}
{% set price=((PM + CGS + k)*(1 + FP) + TAR) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
{% endfor -%}
Expand Down
16 changes: 6 additions & 10 deletions Luzboa-SPOT-BTN-Bi-horário.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,23 @@ template:
state_class: measurement
state: >
{% set PMD = state_attr(this.entity_id, 'PMD') -%}
{% set MIBEL = state_attr(this.entity_id, 'MIBEL') -%}
{% set Desvios = state_attr(this.entity_id, 'Desvios') -%}
{% set SAJ = state_attr(this.entity_id, 'SAJ') -%}
{% set FA = state_attr(this.entity_id, 'FA') -%}
{% set PT = state_attr(this.entity_id, 'PT') -%}
{% set CG = state_attr(this.entity_id, 'CG') -%}
{% set TEPAi = state_attr(this.entity_id, 'TEPAi') -%}
{% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{% if None in [PMD, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{{ None }}
{% else %}
{% set PFC = PMD + MIBEL + Desvios + SAJ -%}
{% set PFC = PMD + Desvios + SAJ -%}
{{ ((PFC*(1+PT))*FA+(CG)+(TEPAi)) | round(2) }}
{% endif %}
attributes:
friendly_name: "Luzboa SPOT BTN (tarifário bi-horário)"
formula: (ER*PFC*(1+PT)*FA)+(ER*CG)+(ER*TEPAi)
PMD: "{{ state_attr('sensor.omie_spot_price_pt', 'today_average') }}"
MIBEL: "{{ state_attr('sensor.omie_adjustment_price_pt', 'today_average') }}"
Desvios: "{{ 0 }}"
SAJ: "{{ 4 }}"
FA: "{{ 1.02 }}"
Expand All @@ -40,7 +38,6 @@ template:
TEPAi: "{{ state_attr(this.entity_id, 'TAR_vazio') if now().hour < 8 or now().hour > 21 else state_attr(this.entity_id, 'TAR_fora_vazio') }}"
today_hours: >
{% set PMD = state_attr('sensor.omie_spot_price_pt', 'today_average') -%}
{% set MIBEL = state_attr('sensor.omie_adjustment_price_pt', 'today_average') -%}
{% set Desvios = state_attr(this.entity_id, 'Desvios') -%}
{% set SAJ = state_attr(this.entity_id, 'SAJ') -%}
{% set FA = state_attr(this.entity_id, 'FA')-%}
Expand All @@ -49,19 +46,18 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h in state_attr('sensor.omie_spot_price_pt', 'today_hours') -%}
{% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG] %}
{% if None in [PMD, Desvios, SAJ, FA, PT, CG] %}
{% set price = None %}
{% else %}
{% set TEPAi = state_attr(this.entity_id, 'TAR_vazio') if h.hour < 8 or h.hour > 21 else state_attr(this.entity_id, 'TAR_fora_vazio') -%}
{% set PFC = PMD + MIBEL + Desvios + SAJ -%}
{% set PFC = PMD + Desvios + SAJ -%}
{% set price=((PFC*(1+PT))*FA+(CG)+(TEPAi)) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
{% endfor -%}
{{ dict(ns.hourly_data) }}
tomorrow_hours: >
{% set PMD = state_attr('sensor.omie_spot_price_pt', 'tomorrow_average') -%}
{% set MIBEL = state_attr('sensor.omie_adjustment_price_pt', 'tomorrow_average') | float(0) -%}
{% set Desvios = state_attr(this.entity_id, 'Desvios') -%}
{% set SAJ = state_attr(this.entity_id, 'SAJ') -%}
{% set FA = state_attr(this.entity_id, 'FA')-%}
Expand All @@ -70,10 +66,10 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h in state_attr('sensor.omie_spot_price_pt', 'tomorrow_hours') -%}
{% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG] %}
{% if None in [PMD, Desvios, SAJ, FA, PT, CG] %}
{% set price=None %}
{% else %}
{% set PFC = PMD + MIBEL + Desvios + SAJ -%}
{% set PFC = PMD + Desvios + SAJ -%}
{% set TAR_vazio = 9.2 -%}
{% set TAR_fora_vazio = 50.2 -%}
{% set TEPAi = TAR_vazio if h.hour < 8 or h.hour > 21 else TAR_fora_vazio -%}
Expand Down
16 changes: 6 additions & 10 deletions Luzboa-SPOT-BTN-Simples.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,23 @@ template:
state_class: measurement
state: >
{% set PMD = state_attr(this.entity_id, 'PMD') -%}
{% set MIBEL = state_attr(this.entity_id, 'MIBEL') -%}
{% set Desvios = state_attr(this.entity_id, 'Desvios') -%}
{% set SAJ = state_attr(this.entity_id, 'SAJ') -%}
{% set FA = state_attr(this.entity_id, 'FA') -%}
{% set PT = state_attr(this.entity_id, 'PT') -%}
{% set CG = state_attr(this.entity_id, 'CG') -%}
{% set TEPAi = state_attr(this.entity_id, 'TEPAi') -%}
{% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{% if None in [PMD, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{{ None }}
{% else %}
{% set PFC = PMD + MIBEL + Desvios + SAJ -%}
{% set PFC = PMD + Desvios + SAJ -%}
{{ ((PFC*(1+PT))*FA+(CG)+(TEPAi)) | round(2) }}
{% endif %}
attributes:
friendly_name: "Luzboa SPOT BTN (tarifário simples)"
formula: (ER*PFC*(1+PT)*FA)+(ER*CG)+(ER*TEPAi)
PMD: "{{ state_attr('sensor.omie_spot_price_pt', 'today_average') }}"
MIBEL: "{{ state_attr('sensor.omie_adjustment_price_pt', 'today_average') }}"
Desvios: "{{ 0 }}"
SAJ: "{{ 4 }}"
FA: "{{ 1.02 }}"
Expand All @@ -38,7 +36,6 @@ template:
TEPAi: "{{ 36.50 }}"
today_hours: >
{% set PMD = state_attr('sensor.omie_spot_price_pt', 'today_average') -%}
{% set MIBEL = state_attr('sensor.omie_adjustment_price_pt', 'today_average') -%}
{% set Desvios = state_attr(this.entity_id, 'Desvios') -%}
{% set SAJ = state_attr(this.entity_id, 'SAJ') -%}
{% set FA = state_attr(this.entity_id, 'FA')-%}
Expand All @@ -48,18 +45,17 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h in state_attr('sensor.omie_spot_price_pt', 'today_hours') -%}
{% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{% if None in [PMD, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{% set price = None %}
{% else %}
{% set PFC = PMD + MIBEL + Desvios + SAJ -%}
{% set PFC = PMD + Desvios + SAJ -%}
{% set price=((PFC*(1+PT))*FA+(CG)+(TEPAi)) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
{% endfor -%}
{{ dict(ns.hourly_data) }}
tomorrow_hours: >
{% set PMD = state_attr('sensor.omie_spot_price_pt', 'tomorrow_average') -%}
{% set MIBEL = state_attr('sensor.omie_adjustment_price_pt', 'tomorrow_average') | float(0) -%}
{% set Desvios = state_attr(this.entity_id, 'Desvios') -%}
{% set SAJ = state_attr(this.entity_id, 'SAJ') -%}
{% set FA = state_attr(this.entity_id, 'FA')-%}
Expand All @@ -69,10 +65,10 @@ template:
{% set ns = namespace(hourly_data=[]) %}
{% for h in state_attr('sensor.omie_spot_price_pt', 'tomorrow_hours') -%}
{% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{% if None in [PMD, Desvios, SAJ, FA, PT, CG, TEPAi] %}
{% set price = None %}
{% else %}
{% set PFC = PMD + MIBEL + Desvios + SAJ -%}
{% set PFC = PMD + Desvios + SAJ -%}
{% set price=((PFC*(1+PT))*FA+(CG)+(TEPAi)) | round(2) %}
{% endif %}
{% set ns.hourly_data=ns.hourly_data + [(h.isoformat(), price)] %}
Expand Down