-
Can someone help me with an example (although I'm not quite sure if what I want is even achievable with plotly card) how to plot 12 months (yearly) bars graph of electricity usage. I know that there are some examples already, but in my case, there is a twist, that is making me banging my head for couple of weeks already, and I can't work it out... My electricity company meter reset cycle is on 9-th day of every month, what this mean is that for example - the used kWh for the month of May are calculated from 10-th of May to 9-th of June, the used kWh for the month of June are calculated from 10-th of Jun to 9-th of July and so on... (yeah I know it's a bit strange, but that's the way they do it) Currently I'm using a CT clamp meter sensor with HA utility meter helper that reset itself each month on the 9-th day, it is working fine. However when I try to plot a 12 months graph based on statistics with bars for each month till the current one, there are two problems:
Here is my yaml for the card, currently not working
P.S. Recently I noticed HA introduced a new type of card - "Statistic Card" with the parameter "stat_type" and possible value "change". When used it like this and it's parameter "fixed_period" with start and end 10-th to 9-th for given months it's working and snowing the value absolutely correctly. I tried to to use |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
You can definitely do it with this card, but it may require some filters, and maybe some js functions. |
Beta Was this translation helpful? Give feedback.
-
I've thought about this a bit, I think the problem is on the Home Assistant side. I speculate that the monthly statistics pick the last value of each month, not whenever the reset point is. This would explain why the values look correct until the 9th comes.
In any case, if you can post plots with period = day and month, I may be able to help further |
Beta Was this translation helpful? Give feedback.
-
Hi @dbuezas, I'm not quite sure I understand, but here is the code that I'm using for a month graph
This graph is working fine and also Here are my utility meter helpers
Can you give me some example bit of code for this
Uhmm, I definitely don't have enough coding skills to do that As for
I don't think is possible since the sensors used for the graphs are utility meter helpers with state_class=total |
Beta Was this translation helpful? Give feedback.
-
Sure, here it is: |
Beta Was this translation helpful? Give feedback.
Oh, I understand, I thought it would be an accumulating value.
I underestimated the problem, but here's a custom filter that should be able to achieve what you want: