Repository navigation
Help with calculate average price #290
Description
Activity
Hello,
- Install "Average" sensor - https://github.com/Limych/ha-average
- Open
configuration.yamlin the "File Editor" Add-on and add following sensor
sensor: - platform: average name: 'Average Nordpool Price' end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}' duration: days: 30 entities: - sensor.nordpool- Restart Home Assistant.
- Add relevant widget on Dashboard
Please note that sensor doesn't work retrospectively and it needs to aggregate data for 30 days to show actual value.
Thanks.
I'm going to try this.No problem. Could you please close the issue and reopen if you have any further issues.
ThanksIs it possible to get the avg for the current month and week. For example feb, mar, apr etc... Would be great if this value was stored in nordpool sensor.
- avg_last_month ( for today feb)
- avg_last_week (for today week 7)
Hello @Henrik1986
What would be your use case for the averages in context of Home Assistant? There are multiple ways to achieve this and it depends on use case.
I don't pay hourly for my kWh, I pay for an average for the month + fees.
Would like to calculate the monthly and weekly cost of electricity based on the average value from nordpool. Therefore it would be nice to have avg_last_month and avg_last week as attribute.Option 1: Use "Average Sensor" component and create last week and last month sensors. You will need to increase data retention as it defaults to 10 days - https://www.home-assistant.io/integrations/recorder/#purge_keep_days.
Option 2: Feed Nordpool data into InfluxDB and/or Grafana and then build necessary dashboards. In this option you will have the most flexibility.
Thanks for the options. Some questions to option 1. I can't see if its possible to choose the month. If I use start and end i should use timestamp. Will it work if i use this?
start: {{ now().date().replace(day=now().day - now().day+1 ) }}
end: {{ ((now().replace(day=1)+timedelta(days=32)).replace(day=1)-timedelta(days=1)).date() }}And is it possible to add the sensor to long term statistic? https://data.home-assistant.io/docs/statistics/
- locked and limited conversation to collaborators
on Mar 27, 2023
This is not a issue.
I wonder if there is anyone who can help me with a formula.
I would like to get the average price over, let's say, one month from the values from Nordpool.
Is here anyone that has done this and are willing to share this with me?