Open fabbermen opened 1 year ago
I might have found in the coordinator the meaning of the value of charging_schedule:
if self.scheduler.base_schedule_exists() is True: scheduling_params.update( {"value_in_graph": self.raw_two_days.max_value() * 0.75}
Would it be an idea to change value_in_graph with the average price of the energy during the schedule? I believe it would provide more information that way Thanks a lot!
Thanks for the suggestion!
Great suggestion! With this feature and a Wallbox charger you could also keep track of (relatively accurate) monthly charging costs somewhat automatically.
As a temporary fix this might me useful. I've made an adjustment to the apex chart showing also the average price if I am not mistaken. I need to test some more based on more data.
Basically I stopped using the data from the charging_schedule and used the raw data instead. Known issue is the color threshold of the line graph.
type: custom:apexcharts-card
now:
show: true
label: nu
locale: en
header:
show: true
title: YS Smart Charging
show_states: true
colorize_states: true
graph_span: 48h
span:
start: day
apex_config:
legend:
show: false
xaxis:
labels:
show: true
hideOverlappingLabels: true
style:
fontSize: 11
yaxis:
- min: '|-0.01|'
decimals: 2
apex_config:
forceNiceScale: true
all_series_config:
stroke_width: 3
series:
- entity: sensor.ev_smart_charging_charging
name: Stroomprijs nu
unit: ' €/kWh'
data_generator: >
return entity.attributes.raw_two_days.map((entry) => [new
Date(entry.start), entry.value]);
type: line
float_precision: 2
show:
in_header: before_now
extend_to: false
color_threshold:
- value: -100
color: cyan
- value: 0
color: green
- value: 0.2
color: orange
- value: 0.3
color: red
- value: 0.4
color: magenta
- value: 0.5
color: black
- entity: sensor.ev_smart_charging_charging
name: Opladen
unit: ' €/kWh'
data_generator: >
const chargingStart = new Date(entity.attributes["Charging start time"]);
const chargingStop = new Date(entity.attributes["Charging stop time"]);
return entity.attributes.raw_two_days
.filter(entry => new Date(entry.start) >= chargingStart && new Date(entry.end) <= chargingStop)
.map(entry => [new Date(entry.start), entry.value]);
type: column
color: magenta
float_precision: 2
show:
in_header: true
extend_to: false
experimental:
color_threshold: true
love this integration! it saves money and enable drivers to use greener energy. I wonder if it would be too much effort to expose an extra sensor with the average price of the charging schedule that is calculated by the integration. Let's say Charging number of hours is 4. Regardless if these 4 hours are consecutive or 4 "independent charging sessions", the new attribute would be calculated by the average price of electricity during those 4 hours.
This would enable the following goals:
Maybe I can already achieve the same goal by a template sensor; I noticed the charging_schedule attribute has a variable value, but I wouldn't know how to use it, and if it's related to the energy price.
Thanks a lot for your great work! I was looking to support the project, please share a ko fi link for donations!