Advertisement
Thomsen79

apexchart card elpriser

Sep 26th, 2024
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. type: custom:apexcharts-card
  2. card_mod:
  3. style: |
  4. ha-card {
  5. --ha-card-border-radius: 20px;
  6. --ha-card-background: rgba(222, 255, 255, 0.02);
  7. }
  8. show:
  9. last_updated: false
  10. experimental:
  11. color_threshold: true
  12. apex_config:
  13. chart:
  14. height: 320px
  15. xaxis:
  16. type: datetime
  17. labels:
  18. datetimeFormatter:
  19. hour: H
  20. tickPlacement: 'on'
  21. graph_span: 28h
  22. span:
  23. start: hour
  24. offset: '-1h'
  25. now:
  26. show: true
  27. label: Nu
  28. header:
  29. title: El-priser pr. time(Kr./kWh)+Abn.(80,73kr./mdr.)
  30. show: true
  31. show_states: true
  32. colorize_states: true
  33. yaxis:
  34. - min: ~0
  35. max: '|+0.0|'
  36. decimals: 2
  37. apex_config:
  38. max: auto
  39. tickAmount: 5
  40. series:
  41. - entity: sensor.energi_data_service
  42. color_threshold:
  43. - value: -1
  44. color: darkgreen
  45. opacity: 0.7
  46. - value: 1
  47. color: lightgreen
  48. - value: 2
  49. color: green
  50. opacity: 0.7
  51. - value: 2.5
  52. color: red
  53. - value: 3
  54. color: darkred
  55. name: Lige nu
  56. type: area
  57. curve: smooth
  58. show:
  59. in_header: false
  60. header_color_threshold: true
  61. in_chart: true
  62. stroke_width: 2
  63. float_precision: 2
  64. unit: ' kr'
  65. data_generator: |
  66. var today = entity.attributes.raw_today.map((start, index) => {
  67. return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]];
  68. });
  69.  
  70. var extradata = entity.attributes.forecast.map((start, index) => {
  71. return [new Date(start["hour"]).getTime(), entity.attributes.forecast[index]["price"]];
  72. });
  73.  
  74. if (entity.attributes.tomorrow_valid) {
  75. var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
  76. return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]];
  77. });
  78. today = today.concat(tomorrow)
  79. }
  80.  
  81. return today.concat(extradata)
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement