Does anyone know how to create a graph which shows the total solar energy production and the total electric consumption. I like to know how much energy there is left for me to use without paying extra.
And if possible from a specific date because I got my solar panels half of February.
Better will be just one value showing for example +126kWh (in green) if I have power left or when I used more than I produced: -150kWh in red.
EDIT:
I can read my total solar energy production from:
sensor.envoy_122244026326_lifetime_energy_production
And I can read my total power import:
sensor.p1_meter_3c39e72f22ca_total_power_import
But my total power import is like 20.000 kWh so I need to read the total from a specific date when my solar panels where installed so I can check what my usage will be.
At the end I want to have a formula like:
total-energy-production - total-energy-import = some_value
Are you sure this is how your energy company actually bills you? Usually you can not consume power from the grid for free which you returned to the grid at an earlier point in time. Rather you would look at what you are producing at this very moment and if you are producing more then you consume, you can use the delta without paying extra.
There might be some country where what you describe is actually practised, but just making sure
In my country (The Netherlands), your total solar energy is viewed per year and deducted from your total consumption. Everything you still have in the plus after that, you get back at a certain rate that is lower than what you would pay yourself.
So if your yearly solar energy production is 4500kwh and your total consumption from the net is 3000, the company will pay you 1500*0,16 = 240 euro. My contract is from march till march, that is why I need to show it from a specific date.
My guess is that this user lives in The Netherlands. There is a law stating that the energy deliverd to the grid can be use at a later time with no additional costs.
On topic. the user could create an input_number stating the correct start value from when the panels were installed.
But that is for this year starting at 1 January, but I’m already a step further. The only thing I need now is to start it on the 19th of February and show it in a red color when I used more than I produced and show in green when I produced more than I used
Do you have your starting value for your “This Year” import sensor on the day your Solar PV went live…you could just use your Template to subtract this from the reported This Year sensor value and then you’d have an import value from 19th Feb onwards…
I’m sure there are better solutions to this but crude at this is it will prob do what you need…
Isn’t this about “return to the grid” value which we can get from the p1 meter? That would be the excess electricity from the solar production we don’t use.
That value minus the total electricity consumption would be the value you are looking for.
# ---------------------------------------------------------------------------------------------
# Average produced over the last hour
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Average kW Produced Last Hour"
entity_id: sensor.powerwall_solar_now
state_characteristic: mean
max_age:
hours: 1
sampling_size: 720
precision: 3
# ---------------------------------------------------------------------------------------------
# Average over the last 24 hours
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Average kW Produced Last 24 Hour"
entity_id: sensor.powerwall_solar_now
state_characteristic: mean
max_age:
hours: 24
sampling_size: 17280
precision: 3
# ---------------------------------------------------------------------------------------------
# Average over the last hour
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Average kW Used Last Hour"
entity_id: sensor.powerwall_load_now
state_characteristic: mean
max_age:
hours: 1
sampling_size: 720
precision: 3
# ---------------------------------------------------------------------------------------------
# Average over the last 12 hours
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Average kW Used Last 12 Hour"
entity_id: sensor.powerwall_load_now
state_characteristic: mean
max_age:
hours: 12
sampling_size: 8640
precision: 3
# ---------------------------------------------------------------------------------------------
# Average over the last 24 hours
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Average kW Used Last 24 Hour"
entity_id: sensor.powerwall_load_now
state_characteristic: mean
max_age:
hours: 24
sampling_size: 17280
precision: 3
# ---------------------------------------------------------------------------------------------
# Minimum over the last 24 hours
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Minimum kW Used Last 24 Hour"
entity_id: sensor.powerwall_load_now
state_characteristic: value_min
max_age:
hours: 24
sampling_size: 17280
precision: 3
# ---------------------------------------------------------------------------------------------
# Maximum over the last 24 hours
# ---------------------------------------------------------------------------------------------
- platform: statistics
name: "Maximum kW Used Last 24 Hour"
entity_id: sensor.powerwall_load_now
state_characteristic: value_max
max_age:
hours: 24
sampling_size: 17280
precision: 3
Utility Meters:
# ------------------------------------------------------------------------------------
# Energy Consumed
# ------------------------------------------------------------------------------------
daily_energy:
source: "sensor.energy_consumed"
name: "Daily kWh Usage"
cycle: daily
weekly_energy:
source: "sensor.energy_consumed"
name: "Weekly kWh Usage"
cycle: weekly
monthly_energy:
source: "sensor.energy_consumed"
name: "Monthly kWh Usage"
cycle: monthly
yearly_energy:
source: "sensor.energy_consumed"
name: "Yearly kWh Usage"
cycle: yearly
# ------------------------------------------------------------------------------------
# Solar Energy Produced
# ------------------------------------------------------------------------------------
daily_energy_produced:
source: "sensor.solar_energy_produced"
name: "Daily kWh Produced"
cycle: daily
weekly_energy_produced:
source: "sensor.solar_energy_produced"
name: "Weekly kWh Produced"
cycle: weekly
monthly_energy_produced:
source: "sensor.solar_energy_produced"
name: "Monthly kWh Produced"
cycle: monthly
yearly_energy_produced:
source: "sensor.solar_energy_produced"
name: "Yearly kWh Produced"
cycle: yearly
# ------------------------------------------------------------------------------------
# Energy to Battery
# ------------------------------------------------------------------------------------
daily_energy_battery_to:
source: "sensor.energy_to_battery"
name: "Daily kWh to Battery"
cycle: daily
weekly_energy_battery_to:
source: "sensor.energy_to_battery"
name: "Weekly kWh to Battery"
cycle: weekly
monthly_energy_battery_to:
source: "sensor.energy_to_battery"
name: "Monthly kWh to Battery"
cycle: monthly
yearly_energy_battery_to:
source: "sensor.energy_to_battery"
name: "Yearly kWh to Battery"
cycle: yearly
# ------------------------------------------------------------------------------------
# Energy from Battery
# ------------------------------------------------------------------------------------
daily_energy_battery_from:
source: "sensor.energy_from_battery"
name: "Daily kWh from Battery"
cycle: daily
weekly_energy_battery_from:
source: "sensor.energy_from_battery"
name: "Weekly kWh from Battery"
cycle: weekly
monthly_energy_battery_from:
source: "sensor.energy_from_battery"
name: "Monthly kWh from Battery"
cycle: monthly
yearly_energy_battery_from:
source: "sensor.energy_from_battery"
name: "Yearly kWh from Battery"
cycle: yearly
# ------------------------------------------------------------------------------------
# Energy to Grid
# ------------------------------------------------------------------------------------
daily_energy_grid_to:
source: "sensor.energy_to_grid"
name: "Daily kWh to Grid"
cycle: daily
weekly_energy_grid_to:
source: "sensor.energy_to_grid"
name: "Weekly kWh to Grid"
cycle: weekly
monthly_energy_grid_to:
source: "sensor.energy_to_grid"
name: "Monthly kWh to Grid"
cycle: monthly
yearly_energy_grid_to:
source: "sensor.energy_to_grid"
name: "Yearly kWh to Grid"
cycle: yearly
# ------------------------------------------------------------------------------------
# Energy from Grid
# ------------------------------------------------------------------------------------
daily_energy_grid_from:
source: "sensor.energy_from_grid"
name: "Daily kWh from Grid"
cycle: daily
weekly_energy_grid_from:
source: "sensor.energy_from_grid"
name: "Weekly kWh from Grid"
cycle: weekly
monthly_energy_grid_from:
source: "sensor.energy_from_grid"
name: "Monthly kWh from Grid"
cycle: monthly
yearly_energy_grid_from:
source: "sensor.energy_from_grid"
name: "Yearly kWh from Grid"
cycle: yearly
And My templates
#--------------------------------------------------------------------------------------------------
# For Grid to Home/Battery pricing - Usage price I pay from the grid
#--------------------------------------------------------------------------------------------------
- sensor:
- name: "grid_to_home_energy_price"
unique_id: "Grid to Home Energy_Price"
state: >-
{% if states('sensor.powerwall_site_now') | float(0) > 0.001 %}
{{ state('input_number.kwh_cost_from_grid') }}
{% else %}
0.000
{% endif %}
unit_of_measurement: "USD/kWh"
#--------------------------------------------------------------------------------------------------
# For Solar to Grid pricing - Generation price I sell to the grid
#--------------------------------------------------------------------------------------------------
- sensor:
- name: "solar_to_grid_energy_price"
unique_id: "Solar to Grid Energy_Price"
state: >-
{% if states('sensor.powerwall_site_now') | float(0) < -0.001 %}
{{ states('input_number.kwh_revenue_to_grid') }}
{% else %}
0.000
{% endif %}
unit_of_measurement: "USD/kWh"
#--------------------------------------------------------------------------------------------------
# Power to Grid - Make Positive
#--------------------------------------------------------------------------------------------------
- sensor:
- name: "Power to Grid"
unique_id: "Power to Grid"
state: >-
{% if states('sensor.powerwall_site_now') | float(0) < -0.0001 %}
{{ states('sensor.powerwall_site_now') | float(0) | abs}}
{% else %}
0.000
{% endif %}
unit_of_measurement: "kW"
#--------------------------------------------------------------------------------------------------
# Power from Grid - Make Positive
#--------------------------------------------------------------------------------------------------
- sensor:
- name: "Power from Grid"
unique_id: "Power From Grid"
state: >-
{% if states('sensor.powerwall_site_now') | float(0) > 0.001 %}
{{ states('sensor.powerwall_site_now') }}
{% else %}
0.000
{% endif %}
unit_of_measurement: "kW"
#--------------------------------------------------------------------------------------------------
# Power to Battery - Make Positive sensor.powerwall_battery_now
#--------------------------------------------------------------------------------------------------
- sensor:
- name: "Power to Battery"
unique_id: "Power to Battery"
state: >-
{% if states('sensor.powerwall_battery_now') | float(0) < -0.001 %}
{{ states('sensor.powerwall_battery_now') | float(0) | abs}}
{% else %}
0.000
{% endif %}
unit_of_measurement: "kW"
#--------------------------------------------------------------------------------------------------
# Power from Battery - Make Positive sensor.powerwall_battery_now
#--------------------------------------------------------------------------------------------------
- sensor:
- name: "Power from Battery"
unique_id: "Power from Battery"
state: >-
{% if states('sensor.powerwall_battery_now') | float(0) > 0.001 %}
{{ states('sensor.powerwall_battery_now') }}
{% else %}
0.000
{% endif %}
unit_of_measurement: "kW"