Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dopředné hodnoty (atributy) obsahují chybné hodnoty #11

Open
alkaacz opened this issue Nov 15, 2023 · 2 comments
Open

Dopředné hodnoty (atributy) obsahují chybné hodnoty #11

alkaacz opened this issue Nov 15, 2023 · 2 comments

Comments

@alkaacz
Copy link

alkaacz commented Nov 15, 2023

Chtěl jsem si zobrazit do grafu 3 ceny z Entit:

  • current_market_price_czk_kwh
  • current_consumption_price_czk_kwh
  • current_production_price_consumption_with_nano_czk_kwh

Použil jsem doporučený https://github.com/RomRider/apexcharts-card.
Tento graf ovšem pro všechny 3 řady hodnot má stejný průběh:
nanogreen_integrace_apexchart

Zjistil jsem, že Entity current_consumption_price_czk_kwh a current_production_price_consumption_with_nano_czk_kwh mají v Atributtes hodnoty z current_market_price_czk_kwh.
nanogreen_integrace_Entity_dopředné_hodnoty

Domnívám se, že to je chyba.

Samozřejmě lze pro zobrazení použít korekci přímo ve výpočtu, ale trochu jsem se s tím potrápil, tak to sem zapíšu.

@martinskokan
Copy link

resil jsem stejny problem. @alkaacz muzu poprosit o navod, jak jsi upravil vypocet, aby se ceny v doprednem grafu zobrazovaly spravne? dekuji.

@alkaacz
Copy link
Author

alkaacz commented Sep 3, 2024

Vytvořil jsem takto:

  • platform: template
    sensors:
    current_production_price_consumption_with_nano_2_czk_kwh:
    friendly_name: "Current production price (consumption with Nano) 2 [CZK/kWh]"
    unit_of_measurement: CZK/kWh
    value_template: >-
    {{ (states('sensor.current_production_price_consumption_with_nano_czk_kwh') | float) }}
    attribute_templates:
    today_hourly_prices: >
    {%- set prices = state_attr('sensor.current_market_price_czk_kwh', 'today_hourly_prices') | default([]) %}
    {%- set adjusted_prices = prices | map('float') | list %}
    {%- for price in adjusted_prices %}
    {%- if not loop.first %}, {% endif %}
    {{ (price - 0.726) | round(2) }}
    {%- endfor %}
    tomorrow_hourly_prices: >
    {%- set prices = state_attr('sensor.current_market_price_czk_kwh', 'tomorrow_hourly_prices') | default([]) %}
    {%- set adjusted_prices = prices | map('float') | list %}
    {%- for price in adjusted_prices %}
    {%- if not loop.first %}, {% endif %}
    {{ (price - 0.726) | round(2) }}
    {%- endfor %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants