mampfes / ha_epex_spot

Adds EPEX Spot data to Home Assistant.
MIT License
130 stars 19 forks source link

Readme.cmd point 4 #24

Closed aichingerk closed 1 year ago

aichingerk commented 1 year ago

Hi, in the example script is a typo in line 16 Date(entry.start_time).getTime(), entry.price_eur_per_mwh; }).slice(0,24); correct is: Date(entry.start_time).getTime(), entry.price_eur_per_mwh]; }).slice(0,24);

It would be nice when you can write it down, that example 4 needs the sensor from point 3 that it can work.

Here is also a example for AT and ct/kWh, how i modified your example from readme.cmd

Picture: 2023-04-24 23_04_27-Übersicht – Home Assistant

Code:

type: custom:apexcharts-card
header:
  show: true
  title: Awattar Strom
all_series_config:
  stroke_width: 3
  type: line
  unit: ct/kWh
graph_span: 48h
span:
  start: day
now:
  show: true
  label: Now
color_list:
  - var(--primary-color)
series:
  - entity: sensor.epex_spot_at_price
    yaxis_id: uurprijs
    float_precision: 2
    type: line
    curve: stepline
    extend_to: false
    show:
      extremas: true
    data_generator: >
      return entity.attributes.data.map((entry, index) => { return [new
      Date(entry.start_time).getTime(), entry.price_ct_per_kwh]; }).slice(0,24);
    color_threshold:
      - value: 2
        color: '#186ddc'
      - value: 5
        color: '#04822e'
      - value: 8
        color: '#12A141'
      - value: 10
        color: '#79B92C'
      - value: 12
        color: '#C4D81D'
      - value: 15
        color: '#F3DC0C'
      - value: 18
        color: red
      - value: 20
        color: magenta
  - entity: sensor.epex_spot_at_price
    yaxis_id: uurprijs
    float_precision: 2
    type: line
    curve: stepline
    extend_to: end
    show:
      extremas: true
    data_generator: >
      return entity.attributes.data.map((entry, index) => { return [new
      Date(entry.start_time).getTime(),
      entry.price_ct_per_kwh];}).slice(23,47); 
    color_threshold:
      - value: 2
        color: '#186ddc'
      - value: 5
        color: '#04822e'
      - value: 8
        color: '#12A141'
      - value: 10
        color: '#79B92C'
      - value: 12
        color: '#C4D81D'
      - value: 15
        color: '#F3DC0C'
      - value: 18
        color: red
      - value: 20
        color: magenta
  - entity: sensor.epex_spot_at_price
    yaxis_id: uurprijs
    color: '#7EBAB5'
    float_precision: 2
    type: area
    curve: stepline
    extend_to: false
    data_generator: >
      return entity.attributes.data.map((entry, index) => { return [new
      Date(entry.start_time).getTime(),
      entry.price_ct_per_kwh];}).slice(parseInt(hass.states['sensor.epex_start_low_period'].state.substring(0,2)),parseInt(hass.states['sensor.epex_start_low_period'].state.substring(0,2))+4);

experimental:
  color_threshold: true
yaxis:
  - id: uurprijs
    min: 0.1
    max: 20
    decimals: 2
    apex_config:
      title:
        text: ct/kWh
      tickAmount: 4
apex_config:
  legend:
    show: false
  tooltip:
    x:
      show: true
      format: HH:00 - HH:59
mampfes commented 1 year ago

Thanks for your contribution. I fixed the example.