Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #---------------------------------------------------------------
- # Custom apex chart with energy prices excl. and incl. taxes
- #---------------------------------------------------------------
- type: custom:apexcharts-card
- apex_config:
- chart:
- height: 350px
- all_series_config:
- unit: ' kr.'
- experimental:
- color_threshold: true
- header:
- title: Elpriser pr. time (kr/kWh)
- show: true
- standard_format: true
- show_states: false
- colorize_states: true
- graph_span: 2d
- span:
- start: day
- offset: '-0h'
- yaxis:
- - min: 0
- apex_config:
- tickAmount: 5
- series:
- - entity: sensor.elpriser_inkl_afgifter
- type: column
- name: Inkl. afgifter
- data_generator: |
- var today = entity.attributes.raw_today.map((start, index) => {
- return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]];
- });
- if (entity.attributes.tomorrow_valid) {
- var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
- return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]];
- });
- var data = today.concat(tomorrow);
- } else {
- var data = today
- }
- return data;
- float_precision: 2
- color_threshold:
- - value: 0
- color: green
- - value: 2
- color: orange
- - value: 3.5
- color: red
- - value: 5
- color: darkred
- show:
- extremas: time
- legend_value: false
- - entity: sensor.elpriser_excl_afgifter
- name: Excl. afgifter
- type: line
- color: 03a9f4
- stroke_width: 4
- float_precision: 2
- extend_to: false
- show:
- extremas: true
- legend_value: false
- data_generator: |
- var today = entity.attributes.raw_today.map((start, index) => {
- return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]];
- });
- if (entity.attributes.tomorrow_valid) {
- var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
- return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]];
- });
- var data = today.concat(tomorrow);
- } else {
- var data = today
- }
- return data;
- - entity: sensor.elpriser_inkl_afgifter
- type: line
- name: Refusion
- color: violet
- data_generator: |
- var today = entity.attributes.raw_today.map((start, index) => {
- return [new Date(start["hour"]).getTime(), 0.95375];
- });
- if (entity.attributes.tomorrow_valid) {
- var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
- return [new Date(start["hour"]).getTime(), 0.95375];
- });
- var data = today.concat(tomorrow);
- } else {
- var data = today
- }
- return data;
- show:
- legend_value: false
- in_header: false
- stroke_width: 3
- float_precision: 2
- extend_to: false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement