Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type: sections
- max_columns: 4
- title: Estimat
- path: estimat
- sections:
- - type: grid
- cards:
- - type: entities
- entities:
- - entity: sensor.energy_next_hour
- name: Next Hour
- - entity: sensor.energy_production_today_remaining
- name: Today remaining
- - entity: sensor.energy_current_hour
- name: Current Hour
- - entity: sensor.energy_production_today
- name: Today
- - entity: sensor.energy_production_tomorrow
- name: Tomorrow
- - entity: sensor.power_production_now
- name: Now
- - entity: sensor.power_highest_peak_time_today
- name: Peaktime today
- - entity: sensor.power_highest_peak_time_tomorrow
- name: peaktime tomorrow
- show_header_toggle: false
- title: Solar production forescast
- - type: entity
- entity: sensor.esphome_web_b2bf74_sun12k_daily_production
- name: Produktion i dag
- - type: entity
- entity: sensor.deye_samlet_pv_effekt
- name: Nuværende sol effekt
- - type: entity
- entity: sensor.seplos_battery_1_battery
- name: Battery
- - type: entity
- entity: sensor.nord_pool_dk1_current_price
- name: Salgspris
- - type: grid
- cards:
- - title: Energy distribution today
- type: energy-distribution
- link_dashboard: true
- - type: custom:apexcharts-card
- apex_config:
- chart:
- height: 200
- xaxis:
- type: datetime
- labels:
- datetimeFormatter:
- hour: HH
- tickPlacement: between
- graph_span: 2d
- span:
- end: day
- offset: +1d
- now:
- show: true
- label: Nu
- header:
- show: true
- show_states: true
- colorize_states: true
- yaxis:
- - min: -1
- max: 1.5
- decimals: 1
- apex_config:
- tickAmount: 5
- forceNiceScale: true
- series:
- - entity: sensor.energi_data_service_salg
- name: Lige nu
- color: orange
- type: column
- show:
- in_header: raw
- in_chart: true
- float_precision: 2
- unit: " kr."
- data_generator: >
- /**
- * Get HEX color of data point based on value.
- *
- * @param value { float }
- * @returns { string }
- */
- var colorByValue = function (value) {
- if (value <= -0.5) { return '#ff0303'; } // Dark red
- else if (value < 0) { return '#e65555' } // Red
- else if (value < 0.5) { return '#fc8905' } // Orange
- else if (value < 1.0) { return '#fce005' } // Yellow
- else { return '#2abf1d' } // Green
- }
- /**
- * Build data point object.
- *
- * @param item { object }
- * @param isForecast { boolean }
- * @returns { object }
- */
- var buildDataPoint = function (item, isForecast = false) {
- return {
- x: new Date(item['hour']).getTime(),
- y: item['price'],
- fillColor: isForecast ? '#a1a1aa' : colorByValue(item['price'])
- }
- }
- // Expected data points.
- // Has to equal the value set in "group_span" but as hours.
- // Which means, if you ie. have set "1d" as group span, you should
- set this to 24.
- var expectedDataPoints = 48;
- // Data points
- var data = [];
- // No prices available.
- // Return empty dataset.
- if (!entity.attributes.raw_today) {
- return data;
- }
- // Offset of hours set in "span" option.
- // Note: Only set this, if offset is negative.
- var offsetHours = 24;
- // Get current timestamp (incl. offset).
- var currentTime = new Date().getTime() - (3600000 * offsetHours);
- // Loop through all today's hours and collect prices,
- // but discard hours which have already passed.
- entity.attributes.raw_today.filter(item => new
- Date(item['hour']).getTime() > currentTime).forEach(item => {
- data.push(buildDataPoint(item));
- });
- // If tomorrow prices is available,
- // we'll add those to our dataset.
- if (entity.attributes.tomorrow_valid) {
- entity.attributes.raw_tomorrow.forEach(item => {
- data.push(buildDataPoint(item));
- });
- }
- // Determine if we could use a few forecasted today points
- // to forfill our expected data points.
- var forecastValuesNeeded = expectedDataPoints - data.length;
- // If forecast values are needed and they are available,
- // add forecast data points to our data set,
- // until our expected data points has been reached.
- if (forecastValuesNeeded > 0 && entity.attributes.forecast) {
- var lastKnownDatapointTimestamp = data[data.length - 1]['x'];
- entity.attributes.forecast.filter(item => new Date(item['hour']).getTime() > lastKnownDatapointTimestamp).slice(0, forecastValuesNeeded).forEach(item => {
- data.push(buildDataPoint(item, true));
- });
- }
- return data;
- - entity: sensor.energi_data_service_salg
- name: Lavest i dag
- attribute: today_min
- color: var(--energy-grid-consumption-color)
- transform: |
- return entity.attributes.today_min?.price ?? null
- float_precision: 2
- unit: " kr."
- show:
- in_chart: false
- - entity: sensor.energi_data_service_salg
- name: Højest i dag
- attribute: today_max
- color: var(--energy-grid-consumption-color)
- transform: |
- return entity.attributes.today_max?.price ?? null
- float_precision: 2
- unit: " kr."
- show:
- in_chart: false
- - entity: sensor.energi_data_service_salg
- name: Gns. i dag
- attribute: today_mean
- color: var(--energy-grid-consumption-color)
- float_precision: 2
- unit: " kr."
- show:
- in_chart: false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement