Advertisement
keldbroe

Untitled

Apr 2nd, 2024
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.05 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: 350px
  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.   xaxis:
  21.     axisTicks:
  22.       offsetX: 0
  23.       offsetY: -3
  24.     labels:
  25.       show: true
  26.       format: HH
  27.       tickAmount: 11
  28.       style:
  29.         fontSize: 10px
  30.         fontWeight: 399
  31.   plotOptions:
  32.     bar:
  33.       dataLabels:
  34.         position: center
  35.         maxItems: 32
  36.         hideOverflowingLabels: true
  37.         orientation: vertical
  38.       columnWidth: 90%
  39.   dataLabels:
  40.     enabled: true
  41.     style:
  42.       fontSize: 10px
  43.       colors:
  44.        - '#fff'
  45.     distributed: true
  46.     background:
  47.       enabled: false
  48.     formatter: |
  49.      EVAL:function(value) {
  50.         return value.toFixed(2);
  51.       }
  52. all_series_config:
  53.   unit: ' kr.'
  54. experimental:
  55.   color_threshold: true
  56. header:
  57.   title: Sammensætning af elpris
  58.   show: true
  59.   standard_format: true
  60.   show_states: false
  61.   colorize_states: true
  62. stacked: true
  63. now:
  64.   show: true
  65.   label: Nu
  66. graph_span: 23h
  67. span:
  68.   start: day
  69.   offset: '-0h'
  70. yaxis:
  71.   - min: 0
  72.     max: 4
  73.     apex_config:
  74.       tickAmount: 5
  75. series:
  76.   - entity: sensor.energi_data_service
  77.     type: line
  78.     name: Total
  79.     data_generator: |
  80.      var today = entity.attributes.raw_today.map((start, index) => {
  81.         return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]];
  82.       });
  83.       if (entity.attributes.tomorrow_valid) {
  84.         var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
  85.         return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]];
  86.         });
  87.  
  88.         var data = today.concat(tomorrow);
  89.       } else {
  90.         var data = today
  91.       }
  92.       return data;
  93.     float_precision: 2
  94.     show:
  95.       legend_value: false
  96.       in_header: false
  97.       datalabels: false
  98.     extend_to: now
  99.     color_threshold:
  100.       - value: 0
  101.         color: green
  102.       - value: 2
  103.         color: yellow
  104.       - value: 3
  105.         color: orange
  106.       - value: 4
  107.         color: red
  108.       - value: 5
  109.         color: darkred
  110.   - entity: sensor.energi_data_service
  111.     type: column
  112.     name: Elafgift
  113.     color: '#00B0F0'
  114.     data_generator: |
  115.      var afgift = entity.attributes.tariffs.additional_tariffs.elafgift;
  116.       var today = entity.attributes.raw_today.map((start, index) => {
  117.         return [new Date(start["hour"]).getTime(), afgift];
  118.       });
  119.       if (entity.attributes.tomorrow_valid) {
  120.         var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
  121.         return [new Date(start["hour"]).getTime(), afgift];
  122.         });
  123.  
  124.         var data = today.concat(tomorrow);
  125.       } else {
  126.         var data = today
  127.       }
  128.       return data;
  129.     float_precision: 2
  130.     show:
  131.       legend_value: false
  132.       in_header: false
  133.       datalabels: true
  134.   - entity: sensor.energi_data_service
  135.     type: column
  136.     name: Tariffer
  137.     color: '#63666A'
  138.     data_generator: >
  139.      var energinet =
  140.       entity.attributes.tariffs.additional_tariffs.transmissions_nettarif +
  141.       entity.attributes.tariffs.additional_tariffs.systemtarif;
  142.  
  143.       var today = entity.attributes.raw_today.map((start, index) => {
  144.         return [new Date(start["hour"]).getTime(), entity.attributes.tariffs.tariffs[index]+ energinet];
  145.       });
  146.  
  147.       if (entity.attributes.tomorrow_valid) {
  148.         var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
  149.         return [new Date(start["hour"]).getTime(), entity.attributes.tariffs.tariffs[index]+energinet];
  150.         });
  151.  
  152.         var data = today.concat(tomorrow);
  153.       } else {
  154.         var data = today
  155.       }
  156.  
  157.       return data;
  158.     float_precision: 2
  159.     show:
  160.       legend_value: false
  161.       in_header: false
  162.       datalabels: true
  163.   - entity: sensor.energi_data_service
  164.     type: column
  165.     name: Spot
  166.     color: '#92D050'
  167.     data_generator: >
  168.      var afgift = entity.attributes.tariffs.additional_tariffs.elafgift
  169.       +entity.attributes.tariffs.additional_tariffs.transmissions_nettarif +
  170.       entity.attributes.tariffs.additional_tariffs.systemtarif
  171.  
  172.       var today = entity.attributes.raw_today.map((start, index) => {
  173.         return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"] - afgift - entity.attributes.tariffs.tariffs[index]];
  174.       });
  175.  
  176.       if (entity.attributes.tomorrow_valid) {
  177.         var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
  178.         return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"] - afgift - entity.attributes.tariffs.tariffs[index]];
  179.         });
  180.  
  181.         var data = today.concat(tomorrow);
  182.       } else {
  183.         var data = today
  184.       }
  185.  
  186.       return data;
  187.     float_precision: 2
  188.     show:
  189.       legend_value: false
  190.       in_header: false
  191.       datalabels: true
  192.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement