CCCPaste

SPOT Elpriser pr. time (kr/kWh)_SL - Strømlig...

type: custom:apexcharts-card
apex_config:
  chart:
    height: 200px
experimental:
  color_threshold: true
graph_span: 24h
header:
  title: SPOT Elpriser pr. time (kr/kWh)_SL
  show: true
span:
  start: hour
  offset: "-2h"
now:
  show: true
  label: Nu
yaxis:
  - min: 0
    apex_config:
      tickAmount: 5
series:
  - entity: sensor.stromligning_spotprice_vat
    type: column
    name: Spot
    color: "#92D050"
    data_generator: >
      var data = entity.attributes.prices.map((start, index) => {
        return [new Date(start["start"]).getTime(), entity.attributes.prices[index]["price"]];
      });

      if (hass.states['binary_sensor.stromligning_tomorrow_spotprice_vat'].state
      == "on") {
        var tomorrow = hass.states['binary_sensor.stromligning_tomorrow_spotprice_vat'].attributes.prices.map((start, index) => {
          return [new Date(start["start"]).getTime(), hass.states['binary_sensor.stromligning_tomorrow_spotprice_vat'].attributes.prices[index]["price"]];
        });
        data = data.concat(tomorrow)
      } return data;
    float_precision: 2
    show:
      in_header: false
    color_threshold:
      - value: 0
        color: green
      - value: 0.5
        color: orange
      - value: 1.5
        color: red
      - value: 4
        color: darkred