Advertisement
Hoekeren75

Apexcard elpriser

Dec 11th, 2024
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. type: custom:config-template-card
  2. entities:
  3. - sensor.stromligning_current_price
  4. - sensor.historic_energy_price_percentiles
  5. config_templates: default
  6. variables:
  7. max_price_threshold: |
  8. () => {
  9. return states['sensor.historic_energy_price_percentiles'].attributes['99th']
  10. }
  11. get_yellow_threshold: |
  12. () => {
  13. return states['sensor.historic_energy_price_percentiles'].attributes['25th']
  14. }
  15. get_orange_threshold: |
  16. () => {
  17. return states['sensor.historic_energy_price_percentiles'].attributes['75th']
  18. }
  19. get_darkred_threshold: |
  20. () => {
  21. return states['sensor.historic_energy_price_percentiles'].attributes['95th']
  22. }
  23. card:
  24. type: custom:apexcharts-card
  25. graph_span: 47h
  26. span:
  27. end: day
  28. offset: +23h
  29. apex_config:
  30. chart:
  31. height: 200px
  32. grid:
  33. show: true
  34. borderColor: rgb(158, 158, 158)
  35. strokeDashArray: 2
  36. annotations:
  37. position: back
  38. yaxis:
  39. - "y": 0
  40. y2: ${ get_yellow_threshold() }
  41. fillColor: rgb(76, 175, 80)
  42. strokeDashArray: 0
  43. borderColor: "#00000000"
  44. - "y": ${ get_yellow_threshold() }
  45. y2: ${ get_orange_threshold() }
  46. fillColor: rgb(255, 193, 7)
  47. strokeDashArray: 0
  48. borderColor: "#00000000"
  49. - "y": ${ get_orange_threshold() }
  50. y2: ${ get_darkred_threshold() }
  51. fillColor: rgb(255, 152, 0)
  52. strokeDashArray: 0
  53. borderColor: "#00000000"
  54. - "y": ${ get_darkred_threshold() }
  55. y2: ${ max_price_threshold() }
  56. fillColor: rgb(244, 67, 54)
  57. strokeDashArray: 0
  58. borderColor: "#00000000"
  59. - "y": ${ max_price_threshold() }
  60. y2: 100
  61. fillColor: rgb(255, 0, 0)
  62. strokeDashArray: 0
  63. borderColor: "#00000000"
  64. header:
  65. show: true
  66. title: Elpriser pr. time (DKK/kWh)
  67. show_states: true
  68. colorize_states: true
  69. now:
  70. label: Nu
  71. show: true
  72. color: black
  73. yaxis:
  74. - min: "|-0.5|"
  75. max: "|+0.5|"
  76. apex_config:
  77. tickAmount: 12
  78. forceNiceScale: false
  79. decimalsInFloat: 1
  80. series:
  81. - name: Nu
  82. entity: sensor.energi_data_service
  83. color: rgb(33, 150, 243)
  84. float_precision: 2
  85. data_generator: |
  86. return [[new Date(), entity.state]]
  87. show:
  88. in_chart: false
  89. - name: Current
  90. entity: sensor.energi_data_service
  91. stroke_width: 3
  92. float_precision: 2
  93. type: line
  94. color: rgb(33, 150, 243)
  95. extend_to: false
  96. show:
  97. in_header: false
  98. data_generator: |
  99. var today = entity.attributes.raw_today.map((start, index) => {
  100. return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]];
  101. });
  102. if (entity.attributes.tomorrow_valid) {
  103. var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
  104. return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]];
  105. });
  106.  
  107. var data = today.concat(tomorrow);
  108. } else {
  109. var data = today
  110. }
  111. return data;
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement