TorbenH

Elpriser pr. time_SL - Strømligning

Nov 4th, 2025 (edited)
924
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.80 KB | Source Code | 1 0
  1. type: custom:apexcharts-card
  2. apex_config:
  3.   chart:
  4.     height: 350px
  5.     toolbar:
  6.       show: true
  7.       offsetY: -27
  8.       tools:
  9.         selection: true
  10.         download: false
  11.         zoom: false
  12.         zoomin: true
  13.         zoomout: true
  14.         pan: true
  15.         reset: true
  16.     zoom:
  17.       enabled: true
  18.   tooltip:
  19.     fixed:
  20.       enabled: true
  21.       position: topRight
  22. all_series_config:
  23.   unit: " kr."
  24. experimental:
  25.   color_threshold: true
  26. header:
  27.   title: Elpriser pr. time_SL
  28.   show: true
  29.   standard_format: true
  30.   show_states: true
  31.   colorize_states: true
  32. now:
  33.   show: true
  34.   label: Nu
  35. show:
  36.   last_updated: true
  37. graph_span: 36h
  38. span:
  39.   start: hour
  40.   offset: "-6h"
  41. yaxis:
  42.   - min: 0
  43.     apex_config:
  44.       tickAmount: 5
  45. series:
  46.   - entity: sensor.stromligning_current_price_vat
  47.     type: column
  48.     name: Inkl. afgifter
  49.     data_generator: >
  50.      var data = entity.attributes.prices.map((start, index) => {
  51.         return [new Date(start["start"]).getTime(), entity.attributes.prices[index]["price"]];
  52.       });
  53.  
  54.  
  55.       if (hass.states['binary_sensor.stromligning_tomorrow_available_vat'].state
  56.       == "on") {
  57.         var tomorrow = hass.states['binary_sensor.stromligning_tomorrow_available_vat'].attributes.prices.map((start, index) => {
  58.           return [new Date(start["start"]).getTime(), hass.states['binary_sensor.stromligning_tomorrow_available_vat'].attributes.prices[index]["price"]];
  59.         });
  60.         data = data.concat(tomorrow)
  61.       } return data;
  62.     float_precision: 2
  63.     color_threshold:
  64.       - value: 0
  65.         color: green
  66.       - value: 1.5
  67.         color: orange
  68.       - value: 2.5
  69.         color: red
  70.       - value: 4
  71.         color: darkred
  72.     show:
  73.       in_header: raw
  74.       extremas: time
  75.       legend_value: false
  76.   - entity: sensor.stromligning_current_price_vat
  77.     name: Excl. afgifter
  78.     type: line
  79.     color: 03a9f4
  80.     stroke_width: 4
  81.     float_precision: 2
  82.     extend_to: false
  83.     show:
  84.       in_header: false
  85.       extremas: true
  86.       legend_value: false
  87.     data_generator: >
  88.      var tax =
  89.       parseFloat(hass.states['sensor.stromligning_electricity_tax_vat'].state)
  90.       || 0; var data = entity.attributes.prices.map((start, index) => {
  91.         return [new Date(start["start"]).getTime(), entity.attributes.prices[index]["price"] - tax];
  92.       });
  93.  
  94.       if (hass.states['binary_sensor.stromligning_tomorrow_available_vat'].state
  95.       == "on") {
  96.         var tomorrow = hass.states['binary_sensor.stromligning_tomorrow_available_vat'].attributes.prices.map((start, index) => {
  97.           return [new Date(start["start"]).getTime(), hass.states['binary_sensor.stromligning_tomorrow_available_vat'].attributes.prices[index]["price"] - tax];
  98.         });
  99.         data = data.concat(tomorrow)
  100.       } return data;
  101.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment