Closed plut9 closed 3 months ago
It appears that the issue stems from the way the Mojelektro API functions, particularly its real-time performance.
The data you see on the Mojelektro web interface includes updated and corrected historical values. However, Home Assistant cannot correct historical data once the day is over.
The root of the problem is with Mojelektro and the way your electric meters transmit data to the distributors for calculation, tipically between 0:00 and 6:00. But sometimes, this data transfer can be delayed by a day or even a week, depending on your location and your power-data connection with the distributor.
Apex charts and Mojelektro component can only display the latest data available before the end of the day. After that, Home Assistant cannot alter historical data.
As for dashboard, you'll need additional zigbee or wifi plugs (shelly, sonoff...) with EM power calculations.
For example, this is Apex Chart donut:
type: horizontal-stack
cards:
- type: custom:apexcharts-card
chart_type: donut
card_mod:
style: |
ha-card {
padding-top:20px;
padding-bottom:20px;
overflow:visible !important;
}
ha-card .apexcharts-legend{
display: none !important;
}
color_list:
- '#B75DCF'
- '#B75DCF'
- '#B75DCF'
- '#CF7F5D'
- '#59bf40'
- '#bf4043'
- '#50af9a'
- '#542aa5'
- '#6d928a'
- '#81817e'
- '#dcd6de'
- '#96a05f'
show:
loading: false
apex_config:
chart:
animations:
enabled: false
stacked: true
background:
enabled: false
dropShadow:
enabled: false
dataLabels:
enabled: false
formatter: |
EVAL:function(value) {
return value.toFixed(0) + " %";
}
background:
enabled: false
dropShadow:
enabled: false
grid:
padding:
left: 0
right: 0
markers:
size: 0
stroke:
show: true
width: 1
legend:
show: false
plotOptions:
pie:
donut:
size: 120
background: transparent
labels:
name:
show: true
fontFamily: SegoeUI
color: white
offsetY: -12
value:
show: true
fontSize: 20px
fontWeight: 100
fontFamily: SegoeUI
offsetY: -6
show: true
total:
fontSize: 10px
fontFamily: SegoeUI
show: true
label: Current
formatter: |
EVAL:function(w) {
return w.globals.seriesTotals.reduce((a, b) => {return (a + b)} , 0).toFixed(2) + " W"
}
update_interval: 5sec
series:
- entity: sensor.smart_plug_current_power
name: M Bojler
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_7_power
name: Fridge
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_8_power
name: Microwave
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_2_power
name: Comp
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_3_power
name: Humid
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_4_power
name: TV
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_6_sonoff_power
name: AC
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_5_sonoff_power
name: Boiler
float_precision: 2
show:
legend_value: false
- entity: sensor.shelly_em3_channel_a_power
name: Oven
float_precision: 2
show:
legend_value: false
- entity: sensor.shelly_em3_channel_b_power
name: Dishes
float_precision: 2
show:
legend_value: false
- entity: sensor.shelly_em3_channel_c_power
name: Cook
float_precision: 2
show:
legend_value: false
- entity: sensor.lights_all_grouped_power
name: Lights
float_precision: 2
show:
legend_value: false
- type: custom:apexcharts-card
chart_type: donut
card_mod:
style: |
ha-card {
padding-top:20px;
padding-bottom:20px;
overflow:visible !important;
}
ha-card .apexcharts-legend{
display: none !important;
}
color_list:
- '#CF7F5D'
- '#B75DCF'
- '#59bf40'
- '#bf4043'
- '#CFBF5D'
- '#50af9a'
- '#542aa5'
- '#6d928a'
- '#81817e'
- '#dcd6de'
- '#a0a25d'
show:
loading: false
apex_config:
chart:
animations:
enabled: false
stacked: true
dataLabels:
enabled: false
formatter: |
EVAL:function(value, opt) {
return value.toFixed(0) + " %";
}
grid:
padding:
left: 0
right: 0
background:
enabled: false
dropShadow:
enabled: false
markers:
size: 0
stroke:
show: true
width: 1
legend:
show: false
plotOptions:
pie:
donut:
size: 120
background: transparent
labels:
name:
show: true
fontFamily: SegoeUI
color: white
offsetY: -12
value:
show: true
fontSize: 20px
fontWeight: 100
fontFamily: SegoeUI
offsetY: -6
show: true
total:
fontSize: 10px
fontFamily: SegoeUI
show: true
label: Daily
formatter: |
EVAL:function(w) {
return w.globals.seriesTotals.reduce((a, b) => {return (a + b)} , 0).toFixed(2) + " kWh"
}
update_interval: 15min
series:
- entity: sensor.smart_plug_2_daily_kwh
name: Comp
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_utility_combined_daily_kwh
name: Utility
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_3_daily_kwh
name: Humid
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_4_daily_kwh
name: TV
float_precision: 2
show:
legend_value: false
- entity: sensor.haier_washer_dryer_total_energy_used_daily_kwh
name: Haier
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_6_sonoff_daily_kwh
name: AC
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_5_sonoff_daily_kwh
name: Boiler
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_shelly_1_daily_kwh
name: Oven
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_shelly_2_daily_kwh
name: Dishes
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_shelly_3_daily_kwh
name: Cook
float_precision: 2
show:
legend_value: false
- entity: sensor.lights_all_grouped_energy_daily
name: Lights
float_precision: 2
show:
legend_value: false
- type: custom:apexcharts-card
chart_type: donut
span:
end: day
card_mod:
style: |
ha-card {
padding-top:20px;
padding-bottom:20px;
overflow:visible !important;
}
ha-card .apexcharts-legend{
display: none !important;
}
color_list:
- '#7AA4CF'
- '#CF7F5D'
- '#B75DCF'
- '#59bf40'
- '#bf4043'
- '#CFBF5D'
- '#50af9a'
- '#542aa5'
- '#6d928a'
- '#81817e'
- '#dcd6de'
- '#a0a25d'
show:
loading: false
apex_config:
chart:
animations:
enabled: false
stacked: true
dataLabels:
enabled: false
formatter: |
EVAL:function(value) {
return value.toFixed(0) + " %";
}
grid:
padding:
left: 0
right: 0
background:
enabled: false
dropShadow:
enabled: false
markers:
size: 0
stroke:
show: true
width: 1
legend:
show: false
plotOptions:
pie:
donut:
size: 120
background: transparent
labels:
name:
show: true
fontFamily: SegoeUI
color: white
offsetY: -12
value:
show: true
fontSize: 20px
fontWeight: 100
fontFamily: SegoeUI
offsetY: -6
show: true
total:
fontSize: 10px
fontFamily: SegoeUI
show: true
label: Monthly
formatter: |
EVAL:function(w) {
return w.globals.seriesTotals.reduce((a, b) => {return (a + b)} , 0).toFixed(1) + " kWh"
}
update_interval: 15min
series:
- entity: sensor.energy_monthly_distribution_not_metered
name: Else
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_2_monthly_kwh
name: Comp
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.smart_plug_utility_combined_monthly_kwh
name: Utility
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.smart_plug_3_monthly_kwh
name: Humid
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.smart_plug_4_monthly_kwh
name: TV
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.haier_washer_dryer_total_energy_used_monthly_kwh
name: Haier
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.smart_plug_6_sonoff_monthly_kwh
name: AC
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.smart_plug_5_sonoff_monthly_kwh
name: Boiler
float_precision: 2
show:
legend_value: false
offset_in_name: false
- entity: sensor.smart_plug_shelly_1_monthly_kwh
name: Oven
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_shelly_2_monthly_kwh
name: Dishes
float_precision: 2
show:
legend_value: false
- entity: sensor.smart_plug_shelly_3_monthly_kwh
name: Cook
float_precision: 2
show:
legend_value: false
- entity: sensor.lights_all_grouped_energy_monthly
name: Lights
float_precision: 2
show:
legend_value: false
Thank you. Make sense now.
I've been having trouble displaying the correct values for a few days. As you can see below, the values for Saturday, 13th, and Sunday 14th are the same, 16.2kwh.
However, the values on Mojelektro are different:
Do you have any idea why? It appears that some values for certain dates are repeated. The only thing I changed from your code was the height and color.
It would also be really really nice if you would provide a configuration file of this dashboard :)