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
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_simplesunit_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 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 }}"PT: "{{ 0.1507 }}"CG: "{{ 5 }}"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')-%} {% set PT = state_attr(this.entity_id, 'PT') -%} {% set CG = state_attr(this.entity_id, 'CG') -%} {% set TEPAi = state_attr(this.entity_id, 'TEPAi') -%} {% 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, TEPAi] %} {% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %} {% set price = None %} {% else %} {% 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 TEPAi = 36.50 -%} {% 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, TEPAi] %} {% if None in [PMD, MIBEL, Desvios, SAJ, FA, PT, CG, TEPAi] %} {% set price = None %} {% else %} {% 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) }}
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