Giter VIP home page Giter VIP logo

Comments (20)

luuuis avatar luuuis commented on June 2, 2024 2

@tretabyte os valores do bi-horário estavam de facto mal no exemplo que eu dei porque as TAR estavam em €/MWh enquanto que os outros valores estavam em €/kWh.

Actualizei há pouco o Wiki para comunicar melhor os exemplos dos vários tarifários. Abrir https://github.com/luuuis/hass_omie/wiki/Tarifários-Portugal para dar com os sensores corrigidos.

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024 1

@pvieira84 vê se te serve este exemplo que o Tiago Veloso partilhou em https://forum.cpha.pt/t/integracao-omie-precos-horarios-diarios-mecanismo-de-ajuste/11668/122

template:
  sensor:
    - name: Luzboa Daily Spot Cost
      unit_of_measurement: €/kWh
      state_class: measurement
      state: |-
        {% set PMD = state_attr(this.entity_id, 'PMD') | float(default=0) -%}
        {% set MIBEL = state_attr(this.entity_id, 'MIBEL') | float(default=0) -%}
        {% set Desvios = state_attr(this.entity_id, 'Desvios') | float(default=0) -%}
        {% set SAJ = state_attr(this.entity_id, 'SAJ') | float(default=0) -%}
        {% set PFC = ((PMD+MIBEL)/1000) + Desvios + SAJ -%}
        {% set FA = state_attr(this.entity_id, 'FA') | float(default=0) -%}
        {% set PT = state_attr(this.entity_id, 'PT') | float(default=0) -%}
        {% set CG = state_attr(this.entity_id, 'CG') | float(default=0) -%}
        {% set TEPAi = state_attr(this.entity_id, 'TEPAi') | float(default=0) -%}
        
        {{( (PFC*(1+PT))*FA+(CG)+(TEPAi) ) | round(4) }}
      attributes:
        friendly_name: "Luzboa €/kWh"
        formula: (ER*PFC*(1+PT)*FA)+(ER*CG)+(ER*TEPAi)
        PMD: "{{ state_attr('sensor.omie_spot_price_pt', 'today_average') | float(default=0) }}"
        MIBEL: "{{ state_attr('sensor.omie_adjustment_price_pt', 'today_average') | float(default=0) }}"
        Desvios: "{{ 0 | round(4) }}"
        SAJ: "{{ 0.004 | round(4) }}"
        FA: "{{ 1.02 | round(4) }}"
        PT: "{{ 0.1507 | round(4) }}"
        CG: "{{ 0.005 | round(4) }}"
        TEPAi: "{{ -0.09580 | round(4) }}"

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024 1

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024 1

from hass_omie.

pvieira84 avatar pvieira84 commented on June 2, 2024

@luuuis obrigado, vou usar. Um abraço

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024

Viva nao ha exemplo para o bi-horario diario e semanal?

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

@codedmind tenta assim para aplicar a TAR correcta para vazio e fora de vazio. A única diferença está na linha TEPAi:.

template:
  sensor:
    - name: Luzboa Daily Spot Cost
      unit_of_measurement: €/kWh
      state_class: measurement
      state: |-
        {% set PMD = state_attr(this.entity_id, 'PMD') | float(default=0) -%}
        {% set MIBEL = state_attr(this.entity_id, 'MIBEL') | float(default=0) -%}
        {% set Desvios = state_attr(this.entity_id, 'Desvios') | float(default=0) -%}
        {% set SAJ = state_attr(this.entity_id, 'SAJ') | float(default=0) -%}
        {% set PFC = ((PMD+MIBEL)/1000) + Desvios + SAJ -%}
        {% set FA = state_attr(this.entity_id, 'FA') | float(default=0) -%}
        {% set PT = state_attr(this.entity_id, 'PT') | float(default=0) -%}
        {% set CG = state_attr(this.entity_id, 'CG') | float(default=0) -%}
        {% set TEPAi = state_attr(this.entity_id, 'TEPAi') | float(default=0) -%}
        
        {{( (PFC*(1+PT))*FA+(CG)+(TEPAi) ) | round(4) }}
      attributes:
        friendly_name: "Luzboa €/kWh"
        formula: (ER*PFC*(1+PT)*FA)+(ER*CG)+(ER*TEPAi)
        PMD: "{{ state_attr('sensor.omie_spot_price_pt', 'today_average') | float(default=0) }}"
        MIBEL: "{{ state_attr('sensor.omie_adjustment_price_pt', 'today_average') | float(default=0) }}"
        Desvios: "{{ 0 | round(4) }}"
        SAJ: "{{ 0.004 | round(4) }}"
        FA: "{{ 1.02 | round(4) }}"
        PT: "{{ 0.1507 | round(4) }}"
        CG: "{{ 0.005 | round(4) }}"
        TEPAi: "{{ -118.5 if now().hour < 8 or now().hour > 21 else -84.2 }}"

from hass_omie.

tretabyte avatar tretabyte commented on June 2, 2024

é suposto o valor final aparecer negativo?

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

@tretabyte é normal consoante a altura do dia. Se consultares a fórmula do sensor compreenderás porquê (o valor TEPAi é negativo).

Monosnap 2023-05-19 12-49-04

from hass_omie.

tretabyte avatar tretabyte commented on June 2, 2024

eu achei estranho pq o valor está constantemente a mostrar-me negativo, estava a espera de haver oscilações (afinal era um erro do meu lado)
esse grafico parece-me bastante mais explicativo do que o da energia (apesar de ser basicamente a mesma coisa SE os sensores estiverem corretamente colocados), da para partilhar o codigo? :)

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

grafico parece-me bastante mais explicativo do que o da energia (apesar de ser basicamente a mesma coisa SE os sensores estiverem corretamente colocados), da para partilhar o codigo? :)

Aqui está → https://github.com/luuuis/hass_omie/wiki/ApexChartsYesterdayTodayTomorrow

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024

@luuuis excelente!!! Muito obrigado. Só me falta é a compra da suelectricidade, mas com os desvios e o raio nem sei se será possivel

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

Os desvios, podes sempre usar uma estimativa (valor fixo ou médias, conforme o que for mais adequado). Estes sensores da Luzboa também usam Desvios: 0.

Já o raio é capaz de ser mais complicado! 😆

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

Corrigido, obrigado.

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

Ups, tenho de arranjar maneira de transferir do ambiente de testes para o Wiki sem me esquecer de nada. 🤓 ✓

from hass_omie.

tretabyte avatar tretabyte commented on June 2, 2024

acho que é um typo, pela logica de tudo o resto, o nome certo deverá ser sensor.template_luzboa_excedente_indexado (penso eu de que)
parece-me que algo está a faltar ou errado pq no grafico de hoje (no conjunto dos 3 dias, ontem/hoje/amanha) a linha do buy nunca parece aparecer.

from hass_omie.

codedmind avatar codedmind commented on June 2, 2024

from hass_omie.

luuuis avatar luuuis commented on June 2, 2024

@codedmind novo issue para isso sff, aqui é Luzboa e penso que já está resolvido.

from hass_omie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.