Closed salzrat closed 1 year ago
Dear @salzrat, I'm not the owner of this product or it code. I just came across this bug. It is possible to have calculated variables for sensors: like this: sensor:
Yes, that is possible. But what I would need is to compute an average based on historical values of sensor states. Actually, a combination of statistics values for each hour of a day (because the smartmeter integration provides an entity that has only statistics, but no state), and the corresponding values from the epex spot-price...
Dear @salzrat, I'm not the owner of this product or it code. I just came across this bug. It is possible to have calculated variables for sensors: like this:
sensor:
- platform: template
sensors:
mysensorname:
friendly_name: "Water usage cost"
unit_of_measurement: "EUR"
icon_template: "mdi:currency-eur"
value_template: >-
{% set a = states('sensor.waterverbruik_vandaag') | float %}
{% set b = states('input_number.cost_per_liter') | float %}
{% set c = states('input_number.vat') | float %}
{% set d = states('input_number.fixedcosts') | float / 365 %}
{{ (((a * b) + a * c) + d) | round(2) }}
Disclaimer: I'm not an expert in Homeassistant setups at all, so please don't ask any detailed questions. I just want to point out that it is possible to define a new calculated value based on other values
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.
I ended up writing a huge sql query with the sql query integration, that works now...
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity.
Checklist
dev
branchIs your feature request related to a problem? Please describe. I use an integration that adds hourly power consumption from my smartmeter to a statistics entity. Since the data comes 1 day late, the entity has only statistics, no state. I can display this nicely with apexcharts. However, I cannot (or do not know) how to do any calculations with it.
Since apexcharts knows how to access the statistics, maybe there is some way how to add some functionality to access statistical data to calculate averages.
Describe the solution you'd like Concretely, I would like to calculate my daily average energy price based on an hourly tariff (from Epex), i.e.: hour1_consumptionhour1_price + hour2_consumptionhour2_price + ... /total_daily_consumption. I'd like to plot the result in a chart and compare with the average energy price.
Describe alternatives you've considered I can't think of any.
Additional context The smartmeter integration is described here: https://github.com/DarwinsBuddy/WienerNetzeSmartmeter and the spot energy prices here: https://github.com/mampfes/ha_epex_spot
Currently, I'm plotting the energy price and consumption over one day like this: