Wykres kolumnowy custom:bar-card / apexcharts-card dla prognoz z solcast_pv_forecast

Próbuję stworzyć wykres kolumnowy dla prognoz produkcji PV z integracji solcast. Chyba jest problem z encjami bo jak wstawię jakąś inną to coś jest, a tu wygląda tak:


Wartość 1 to encja z bieżącej produkcji z falownika (inna integracja).
Kod kart:

type: custom:apexcharts-card
header:
  title: Wykres Kolumnowy
  show: true
series:
  - entity: sensor.dzienna_produkcja_fotowoltaiki
    type: column
    name: Wartość 1
  - entity: sensor.solcast_pv_forecast_pozostala_prognoza_na_dzis
    type: column
    name: Wartość 2
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzisiaj
    type: column
    name: Wartość 3
  - entity: sensor.solcast_pv_forecast_prognoza_na_jutro
    type: column
    name: Wartość 4
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
    type: column
    name: Wartość 5
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
    type: column
    name: Wartość 6
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
    type: column
    name: Wartość 7
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
    type: column
    name: Wartość 8
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
    type: column
    name: Wartość 9

A atrybuty encji np.:

state_class: total
6fdd-de94-b0a5-dd93: 0.8995
estimate-6fdd-de94-b0a5-dd93: 0.8995
estimate10-6fdd-de94-b0a5-dd93: 0.7819
estimate90-6fdd-de94-b0a5-dd93: 0.929
b0da-fb99-9cf2-6ab1: 36.875
estimate-b0da-fb99-9cf2-6ab1: 36.875
estimate10-b0da-fb99-9cf2-6ab1: 6.0732
estimate90-b0da-fb99-9cf2-6ab1: 43.4215
estimate: 37.7745
estimate10: 6.8552
estimate90: 44.3505
dayname: Sunday
dataCorrect: true
detailedForecast: 
- period_start: '2025-02-09T00:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T00:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T01:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T01:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T02:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T02:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T03:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T03:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T04:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T04:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T05:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T05:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T06:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T06:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T07:00:00+01:00'
  pv_estimate: 0.0332
  pv_estimate10: 0.0111
  pv_estimate90: 0.1186
- period_start: '2025-02-09T07:30:00+01:00'
  pv_estimate: 0.5822
  pv_estimate10: 0.094
  pv_estimate90: 2.2681
- period_start: '2025-02-09T08:00:00+01:00'
  pv_estimate: 1.9768
  pv_estimate10: 0.2046
  pv_estimate90: 4.4304
- period_start: '2025-02-09T08:30:00+01:00'
  pv_estimate: 3.1273
  pv_estimate10: 0.3431
  pv_estimate90: 5.4369
- period_start: '2025-02-09T09:00:00+01:00'
  pv_estimate: 4.1877
  pv_estimate10: 0.5357
  pv_estimate90: 6.3605
- period_start: '2025-02-09T09:30:00+01:00'
  pv_estimate: 4.8209
  pv_estimate10: 0.7048
  pv_estimate90: 6.8515
- period_start: '2025-02-09T10:00:00+01:00'
  pv_estimate: 5.8195
  pv_estimate10: 0.8611
  pv_estimate90: 7.2163
- period_start: '2025-02-09T10:30:00+01:00'
  pv_estimate: 7.1827
  pv_estimate10: 1.0673
  pv_estimate90: 7.4572
- period_start: '2025-02-09T11:00:00+01:00'
  pv_estimate: 7.4481
  pv_estimate10: 1.531
  pv_estimate90: 7.4481
- period_start: '2025-02-09T11:30:00+01:00'
  pv_estimate: 7.1086
  pv_estimate10: 1.6157
  pv_estimate90: 7.1086
- period_start: '2025-02-09T12:00:00+01:00'
  pv_estimate: 6.7193
  pv_estimate10: 1.5791
  pv_estimate90: 6.7193
- period_start: '2025-02-09T12:30:00+01:00'
  pv_estimate: 6.2305
  pv_estimate10: 1.4236
  pv_estimate90: 6.2305
- period_start: '2025-02-09T13:00:00+01:00'
  pv_estimate: 5.7855
  pv_estimate10: 1.187
  pv_estimate90: 5.7855
- period_start: '2025-02-09T13:30:00+01:00'
  pv_estimate: 4.9862
  pv_estimate10: 0.8977
  pv_estimate90: 4.9862
- period_start: '2025-02-09T14:00:00+01:00'
  pv_estimate: 4.0213
  pv_estimate10: 0.6869
  pv_estimate90: 4.0213
- period_start: '2025-02-09T14:30:00+01:00'
  pv_estimate: 3.1166
  pv_estimate10: 0.4669
  pv_estimate90: 3.1166
- period_start: '2025-02-09T15:00:00+01:00'
  pv_estimate: 1.6422
  pv_estimate10: 0.303
  pv_estimate90: 1.9915
- period_start: '2025-02-09T15:30:00+01:00'
  pv_estimate: 0.6656
  pv_estimate10: 0.1599
  pv_estimate90: 1.0105
- period_start: '2025-02-09T16:00:00+01:00'
  pv_estimate: 0.0948
  pv_estimate10: 0.0378
  pv_estimate90: 0.1434
- period_start: '2025-02-09T16:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T17:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T17:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T18:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T18:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T19:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T19:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T20:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T20:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T21:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T21:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T22:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T22:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T23:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T23:30:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0

detailedHourly: 
- period_start: '2025-02-09T00:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T01:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T02:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T03:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T04:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T05:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T06:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T07:00:00+01:00'
  pv_estimate: 0.3077
  pv_estimate10: 0.0525
  pv_estimate90: 1.1933
- period_start: '2025-02-09T08:00:00+01:00'
  pv_estimate: 2.552
  pv_estimate10: 0.2739
  pv_estimate90: 4.9337
- period_start: '2025-02-09T09:00:00+01:00'
  pv_estimate: 4.5043
  pv_estimate10: 0.6202
  pv_estimate90: 6.606
- period_start: '2025-02-09T10:00:00+01:00'
  pv_estimate: 6.5011
  pv_estimate10: 0.9642
  pv_estimate90: 7.3368
- period_start: '2025-02-09T11:00:00+01:00'
  pv_estimate: 7.2783
  pv_estimate10: 1.5734
  pv_estimate90: 7.2783
- period_start: '2025-02-09T12:00:00+01:00'
  pv_estimate: 6.4749
  pv_estimate10: 1.5013
  pv_estimate90: 6.4749
- period_start: '2025-02-09T13:00:00+01:00'
  pv_estimate: 5.3858
  pv_estimate10: 1.0424
  pv_estimate90: 5.3858
- period_start: '2025-02-09T14:00:00+01:00'
  pv_estimate: 3.569
  pv_estimate10: 0.5769
  pv_estimate90: 3.569
- period_start: '2025-02-09T15:00:00+01:00'
  pv_estimate: 1.1539
  pv_estimate10: 0.2314
  pv_estimate90: 1.501
- period_start: '2025-02-09T16:00:00+01:00'
  pv_estimate: 0.0474
  pv_estimate10: 0.0189
  pv_estimate90: 0.0717
- period_start: '2025-02-09T17:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T18:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T19:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T20:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T21:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T22:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0
- period_start: '2025-02-09T23:00:00+01:00'
  pv_estimate: 0
  pv_estimate10: 0
  pv_estimate90: 0

unit_of_measurement: kWh
attribution: Data retrieved from Solcast
device_class: energy
icon: mdi:solar-power
friendly_name: Solcast PV Forecast Prognoza na jutro

Stan normalny tzn. 37,7745
Probowałem robić:

type: vertical-stack
cards:
  - chart_type: bar
    period: day
    days_to_show: 1
    type: statistics-graph

ale efekt podobny, więc coś nie tak z encjami.
Proszę o podpowiedź co jest nie tak lub podzielenie się własnymi kartami.
Za to

type: custom:apexcharts-card
chart_type: donut

wygląda ok

Nie jestem ekspertem od tych wykresów, ale wydaje mi się, że powinieneś, po piewsze, określić zakres czasowy, coś w stylu:

type: custom:apexcharts-card
graph_span: 6d
span:
  start: day

powyższe powinno (chyba) dać wykres od “dziś o północy” do “5 dni w przyszłości”.
Po drugie, trzeba przetworzyć godzinowe dane z atrybutów (z przyszłości), coś w stylu:

- entity: sensor.solcast_pv_forecast_prognoza_na_jutro
  type: column
  name: Wartość 4
  data_generator: |
      return entity.attributes.detailedHourly.map((period_start,pv_estimate,pv_estimate10,pv_estimate90) => {
        return [new Date(period_start).getTime(), pv_estimate];
      });

Chodzi o to, żeby z danych atrybutu generować 2-elementowe tablice, gdzie pierwszy będzie timestamp, a druga wartość, którą chcesz pokazać.

2 polubienia

Dzięki @maciej1 to działa.
Na razie ogarnąłem coś takiego:


Poniżej kod:

variables:
  - states['sensor.date'].state
entities:
  - sensor.dzienna_produkcja_fotowoltaiki
  - sensor.solcast_pv_forecast_pozostala_prognoza_na_dzis
  - sensor.solcast_pv_forecast_prognoza_na_dzisiaj
  - sensor.solcast_pv_forecast_prognoza_na_jutro
  - sensor.solcast_pv_forecast_prognoza_na_dzien_3
  - sensor.solcast_pv_forecast_prognoza_na_dzien_4
  - sensor.solcast_pv_forecast_prognoza_na_dzien_5
  - sensor.solcast_pv_forecast_prognoza_na_dzien_6
  - sensor.solcast_pv_forecast_prognoza_na_dzien_7
card:
  type: custom:bar-card
  decimal: 0
  column: 9
  max: 50
  min: 0
  severity:
    - color: blue
      from: "0"
      to: "10"
    - color: green
      from: "10.1"
      to: "20"
    - color: yellow
      from: "20.1"
      to: "30"
    - color: orange
      from: "30.1"
      to: "40"
    - color: red
      from: "40.1"
      to: "50"
  direction: up
  height: 150px
  width: 24px
  positions:
    indicator: "off"
    value: inside
    title: "off"
    name: inside
    icon: "off"
  animation:
    state: "on"
  card_mod:
    style: |-
      .card-header {
        font-size: 18px;
      }
      bar-card-value, bar-card-name {
        font-size: 12px;
        transform-origin: 0 0;
        transform: rotate(270deg);
        text-shadow: 1px 1px #0008;
        white-space: nowrap;
      }
      bar-card-value {
        margin-right: auto;
        margin-left: 6px;
        margin-bottom: auto;
        margin-top: auto;
      }
      bar-card-name {
        margin-right: auto;
        margin-left: 0px;
        margin-bottom: -130px;
        margin-top: 130px;
        right: 20px;
      }
      bar-card-currentbar, bar-card-backgroundbar {
        border-radius: 12px;
        border: 1px solid #DDD9;    
      }
  stack: horizontal
  title: Prognoza produkcji PV
  entities:
    - entity: sensor.dzienna_produkcja_fotowoltaiki
      name: Dziś wyprodukowało
    - entity: sensor.solcast_pv_forecast_pozostala_prognoza_na_dzis
      name: Pozostało na dziś
    - entity: sensor.solcast_pv_forecast_prognoza_na_dzisiaj
      name: Dziś
    - entity: sensor.solcast_pv_forecast_prognoza_na_jutro
      name: Jutro
    - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
      name: >-
        ${
        ['Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela'][(new
        Date().getDay() + 1) % 7] }
    - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_4
      name: >-
        ${
        ['Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela'][(new
        Date().getDay() + 2) % 7] }
    - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_5
      name: >-
        ${
        ['Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela'][(new
        Date().getDay() + 3) % 7] }
    - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_6
      name: >-
        ${
        ['Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela'][(new
        Date().getDay() + 4) % 7] }
    - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
      name: >-
        ${
        ['Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela'][(new
        Date().getDay() + 5) % 7] }

apex charts musi poczekać.

Udało się:


kod:

type: custom:apexcharts-card
graph_span: 7d
span:
  start: day
header:
  title: Prognozy PV
  show: true
series:
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzisiaj
    type: column
    name: Prognoza na dziś
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };
  - entity: sensor.solcast_pv_forecast_prognoza_na_jutro
    type: column
    name: jutro
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_3
    type: column
    name: za 2 dni
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };    
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_4
    type: column
    name: za 3 dni
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };    
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_5
    type: column
    name: za 4 dni
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };    
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_6
    type: column
    name: za 5 dni
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };
  - entity: sensor.solcast_pv_forecast_prognoza_na_dzien_7
    type: column
    name: za 6 dni
    data_generator: >
      { return entity.attributes.detailedForecast.map(({ period_start,
      pv_estimate, pv_estimate10, pv_estimate90 }) => {
        const globalEstimate = entity.attributes.estimate; // Odczytaj wartość globalnego atrybutu estimate
        return [new Date(period_start).getTime(), globalEstimate];
      }); };
3 polubienia