Advertisement
dykandDK

HA - YAML - Apex chart with energy tariffs

Dec 10th, 2023 (edited)
926
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.81 KB | None | 0 0
  1. type: custom:apexcharts-card
  2. apex_config:
  3.   tooltip:
  4.     x:
  5.       format: ddd kl. HH
  6.   chart:
  7.     height: 220px
  8.     defaultLocale: da
  9.     locales:
  10.       - name: da
  11.         options:
  12.           shortDays:
  13.            - Søn
  14.             - Man
  15.             - Tir
  16.             - Ons
  17.             - Tor
  18.             - Fre
  19.             - Lør
  20.   dataLabels:
  21.     enabled: true
  22.     offsetY: 0
  23.     textAnchor: top
  24.     style:
  25.       fontSize: 6pt
  26.       fontWeight: normal
  27.       colors:
  28.        - '#fff'
  29.     distributed: true
  30.     background:
  31.       enabled: false
  32.   xaxis:
  33.     labels:
  34.       format: HH
  35.     axisBorder:
  36.       show: true
  37.       color: grey
  38.   plotOptions:
  39.     bar:
  40.       dataLabels:
  41.         position: bottom
  42.         maxItems: 32
  43.         hideOverflowingLabels: true
  44.         orientation: vertical
  45.       columnWidth: 90%
  46. all_series_config:
  47.   unit: ' kr.'
  48. experimental:
  49.   color_threshold: true
  50. header:
  51.   title: Tariffer pr. time (kr/kWh)
  52.   show: false
  53.   standard_format: true
  54.   show_states: false
  55.   colorize_states: true
  56. graph_span: 23h
  57. stacked: true
  58. now:
  59.   show: true
  60.   label: Nu
  61. span:
  62.   start: day
  63.   offset: '-0h'
  64. yaxis:
  65.   - min: 0
  66.     max: 1.5
  67.     apex_config:
  68.       tickAmount: 5
  69. series:
  70.   - entity: sensor.energi_data_service
  71.     type: column
  72.     name: Tariffer
  73.     color: orange
  74.     data_generator: |
  75.      var today = entity.attributes.raw_today.map((start, index) => {
  76.         return [new Date(start["hour"]).getTime()+180000, entity.attributes.tariffs.tariffs[index]];
  77.       });
  78.  
  79.       return today;
  80.     float_precision: 2
  81.     show:
  82.       legend_value: false
  83.       datalabels: true
  84.     color_threshold:
  85.       - value: 0
  86.         color: green
  87.       - value: 0.35
  88.         color: orange
  89.       - value: 0.75
  90.         color: red
  91.       - value: 1.5
  92.         color: darkred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement