You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template:
sensor:
- unique_id: luzboa_spot_btn_bihorariounit_of_measurement: '€/MWh'availability: "{{ state_attr('sensor.omie_spot_price_pt', 'today_average') != None and state_attr('sensor.omie_adjustment_price_pt', 'today_average') != None }}"state_class: measurementstate: > {% 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, Desvios, SAJ, FA, PT, CG, TEPAi] %} {% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %} {{ None }} {% else %} {% set PFC = PMD + Desvios + SAJ -%} {% set PFC = PMD + MIBEL + 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 }}"PT: "{{ 0.1507 }}"CG: "{{ 5 }}"TAR_vazio: "{{ 9.2 }}"TAR_fora_vazio: "{{ 50.2 }}"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')-%} {% set PT = state_attr(this.entity_id, 'PT') -%} {% set CG = state_attr(this.entity_id, 'CG') -%} {% set ns = namespace(hourly_data=[]) %} {% for h in state_attr('sensor.omie_spot_price_pt', 'today_hours') -%} {% if None in [PMD, Desvios, SAJ, FA, PT, CG] %} {% if None in [PMD, MIBEL, 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 + Desvios + SAJ -%} {% set PFC = PMD + MIBEL + 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')-%} {% set PT = state_attr(this.entity_id, 'PT') -%} {% set CG = state_attr(this.entity_id, 'CG') -%} {% set ns = namespace(hourly_data=[]) %} {% for h in state_attr('sensor.omie_spot_price_pt', 'tomorrow_hours') -%} {% if None in [PMD, Desvios, SAJ, FA, PT, CG] %} {% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG] %} {% set price=None %} {% else %} {% set PFC = PMD + Desvios + SAJ -%} {% set PFC = PMD + MIBEL + 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 -%} {% 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) }}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters