Excuse the question, but where does this have to go
template:
- sensor:
In the configuration.yaml?
Do I understand correctly that I name my sensors in MQTT and insert them in this template?
Excuse the question, but where does this have to go
template:
In the configuration.yaml?
Do I understand correctly that I name my sensors in MQTT and insert them in this template?
The energy dashboard is great, but one feature that I am really missing is my actual electricity cost/kWh.
Let me explain. I am on an hourly tariff. As setup in the dashboard, I get the horly, daily … costs.
All good.
But as I am trying to “save” as much as possible, I do obviously charge my EV during “low price” periods.
Since the EV consumption is the biggest consumer for my house, my accumulated cost (per time interval) is vastly lower than the average price (per time interval).
That is, I use a lot of electricity when it is cheap, and try to use as little as possible when expensive.
The calculation is (obviusly) simple, acumulated cost/accumulated energy usage. When comparing this to the “price”, it’s really rewarding ; -).
Currently I am migrating from “the other” HA system. There I have this set up by some rules. But shouldn’t this already be a feature of the energy dashboard?, that is cost/kWh
Also, a final query. Is it possible to access the “cost” entity that is already presented in the energy dashboard? It seems silly that I should setup rules for this, since it is obvisously already “in the system”
Blockquote
Is the API what to provide energy (energy dashboard?) described somewhere? I can’t find it.
I’m trying to push obis data into the energy management dashboard.
Same as @RaphDaMan I can read obis using custom tasmota script, but honestly i would like to port it to esphome, it is quite easy UART interface, basically 1 command and parsing output in where it should go into Energy dashboard API.
But to use tasmota output you need to have MQTT setup and then add MQTT sensor, right?
Maybe this way Sonoff Tasmota without MQTT or custom components I can read data without using MQTT
I just set this up a few days ago, but the results are way off.
This is my summary from yesterday:
The solar output of 317 kWh is spot on and matches what my inverters reported within 1%. However, my home did not consume almost 500 kWh.
Here’s a high level diagram of my electrical layout with the main CTs, along with my actual Source readings yesterday from the CTs:
This is how I have those 8 CTs configured:
They are currently all reading positive watt amounts, except the Grid CTs will read negative values when I’m pushing power into the grid. Here are the actual readings in watts from around noon yesterday:
So do I need to flip some of the CTs around in order for the Energy panel to show the proper Net consumption for my Home? Right now HA is summing my Solar total with my Grid total. It should be subtracting the Solar total from the Grid total, no?
I’m using this integration for my CTs:
And this one to convert the readings to something that the Energy panel can consume:
Thanks!
I have updated my power flow diagram for my situation as follows:
It is clear that the entities measuring the energy produced would go under Solar Production as noted above.
I would have also thought that Grid Consumption would be the feeders to my sub-panels where the current always flows towards to loads. I have marked those accordingly above.
So that leaves Return to Grid. As noted above, current can flow in both directions depending on how much energy I’m producing at a given time. In reading through the previous posts, at around post # 1075, it was suggested to create a rule so that when current flows into the grid, it is counted as Return to Grid and that when I’m consuming more than I produce, it is marked as Grid consumption.
Is that what I need to do in my situation to make this Energy flow work out?
I threw together a quick dashboard showing my readings during the day for the above CTs:
I would really like to get this working, but I guess I need to better understand what sensors go where when configuring the Energy dashboard.
I went ahead and defined the following in sensors.yaml:
#########################################
# Main 200A CTs L1 + L2 Totals
#########################################
- platform: template
sensors:
# Grid Total
grid:
unique_id: grid
friendly_name: 'Grid'
unit_of_measurement: "W"
value_template: "{{ (states('sensor.grid_l1') | float) + (states('sensor.grid_l2') | float)}}"
# House Feeder Total
house_feeder:
unique_id: house_feeder
friendly_name: 'House Feeder'
unit_of_measurement: "W"
value_template: "{{ (states('sensor.house_feeder_l1') | float) + (states('sensor.house_feeder_l2') | float)}}"
# Shop Feeder Total
shop_feeder:
unique_id: shop_feeder
friendly_name: 'Shop Feeder'
unit_of_measurement: "W"
value_template: "{{ (states('sensor.shop_feeder_l1') | float) + (states('sensor.shop_feeder_l2') | float)}}"
# Solar Total
solar:
unique_id: solar
friendly_name: 'Solar'
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solar_l1') | float) + (states('sensor.solar_l2') | float)}}"
##########################################
# Split Grid Watts into Ingress and Egress
##########################################
- platform: template
sensors:
# Negative values only - if not negative return 0, otherwise provide "Return to Grid" Value
site_energy_negative:
unique_id: site_energy_negative
friendly_name: 'Site Energy Negative'
unit_of_measurement: 'W'
value_template: >
{% if states('sensor.grid') | int > 0 %}
0
{% else -%}
{{ (states('sensor.grid') | float) | abs }}
{% endif %}
# Positive values only - if negative, return 0, otherwise provide "Power from Grid" Value
site_energy_positive:
unique_id: site_energy_positive
friendly_name: 'Site Energy Positive'
unit_of_measurement: 'W'
value_template: >
{% if states('sensor.grid') | int > 0 %}
{{ states('sensor.grid') }}
{% else -%}
0
{% endif %}
And added the following integrations to configuration.yaml:
sensor:
- platform: integration
source: sensor.site_energy_negative
name: energy_sent_back_to_grid
unit_prefix: k
round: 2
- platform: integration
source: sensor.site_energy_positive
name: energy_received_from_gid
unit_prefix: k
round: 2
- platform: integration
source: sensor.house_feeder
name: energy_house_feeder
unit_prefix: k
round: 2
- platform: integration
source: sensor.shop_feeder
name: energy_shop_feeder
unit_prefix: k
round: 2
- platform: integration
source: sensor.solar
name: energy_solar
unit_prefix: k
round: 2
I then restarted HA to pick up the changes, but when I then go to the Energy dashboard to add any of these sensors, only the energy_received_from_grid shows up:
I have the same issue if I add the Riemann integrations from the GUI.
Any idea why the Energy dashboard is so picky about what sensors it can see?
I believe the energy dashboard needs hourly statistics. You need to wait at least two hours before you can be sure there are any, for new sensors.
Do your integration sensors show up in the development tools → statistics list?
You have to define the device class as well. Look back through the thread for details.
Having browsed through this thread I did not catch any discussion of distributing data points. The problem is similar to the issue of random datapoints coming into the statistics, but in ths case I do not simpy want to delete the stray value, but rather need to distribute it across the preceding days.
The root cause is that my inverter stopped network comminication for a couple of days, and once it came back online again reported the accumulated difference.
So, those 214.7kWh should be distributed across 5 days - and as the inverter has not stored the actuals I am ok with just an average per day.
Deleting this 214.7kWh entry is simple enough in the new Statistics cleanup, but it does not allow me to create new entries for the empty days - and doing so still has to be cascaded to the Consumed solar statistics as well which has a similiar error of accumulated consumption.
Any gudiance on how to address this is welcome.
You can add the missing hourly values to the database directly using the SQLite Web add-on.
Hi!
Have a strange issue when using an infludb sensor to pull the current power usage from my computer (psu) then basing an energy sensor on that. For some reason the energy sensor cannot be found/added to the energy dashboard.
The influxdb sensor looks like this:
- platform: influxdb
host: <redacted>
username: <redacted>
password: <redacted>
queries:
- name: WorkstationPowerConsumption
unit_of_measurement: W
value_template: "{{ value | round(1) }}"
where: 'time > now() - 1m AND "Label" = ''Power Supply'''
measurement: workstation.autogen.pwr
field: "Value"
group_function: last
database: workstation
And seems to work fine.
To accumulate this a Riemann sum integration sensor has been added which also seems to work fine:
But as mentioned above, it cannot be found through the energy dashboard.
Been looking around and suspect its device_class might be missing, it should be energy?
But it was added through the UI so I never had the chance to set this.
Anyone has any experience from this?
Running hass: 2022.8.3 with OS: 8.4.
So I created the dashboard but did not add individual devices, how can i re-crteate a dashboard or add individual measured devices after dashboard already exists?
Update: Reasonable :8123/config/energy but would appreciate button on the dashboard then need to go from dashboard management, from UX perspective it is better.
Looks like for tuya sockets etc. I will need to add sensor that transform current W to kWh aggregated somehow.
And this Integration - Riemann sum integral - Home Assistant won’t work, socket reports current power, i tried what is described in the link and it does not show in energy dashboard settings
Thank you! That was it. But why in Gods name did I not have to do that for almost all my other integration sensors.
All the ones with a checkmark just showed up after adding the Riemann sum integration sensor without me having to add anything to the customize.yaml.
Anyway, glad to finally have this working!
If the socket already supports energy in Wh or kWh then you don’t need to do anything just add it. If it is in W or kW then use the Riemann sum integrations
oh, ok, understood, the issue is that socket reports W, not Wh
Nevermind, for some reason (for second time now) my tuya integration got disabled entities for about half of the stuff, and i also noticed I can click
and it does redirect me where i need to be and then I can add the thing from web ui
I’m trying minutes currently to see if it will work, generally some cookbook how to setup socket that reports W using that thing would be nice.
I guess that I/we have to resort to manual correction for now.
However, it would be great to have the statistics adjustment supporting additions as well as the current deletion.
After the 2022.08 release i‘ve successfully added an eve energy plug per Homekit Controller.
Basically is the device working and shows energy consumption but with a lot decimals
How can i adjust how the values are displayed for instance with only two decimals like 8.00 W
In addition i got an error after i‘ve added the device to the energy dashborad
But i have no idea what to do in order to solve it?
I don’t think you change the number of decimals displayed yourself. You could create an additional template sensor based on this one, where you filter this entity with round(2)
to get 2 decimal places.
The state class for energy measurements should probably be “total_increasing”. You can also fix that with a derived template sensor.
You should probably report this to the integration authors.