I have been setting up home assistant for a few months now and getting top grips with all of the integrations and putting together dashboards. There have been a few issues but after searching on the internet and this I have managed to resolve these with the exception of a few issues.
I have been going around in circles trying to find how to fix this and getting nowhere so decided it is time to ask the masters!
This is the first of them….
I have installed the Octopus tracker that that all works fine for the gas and electricity tariffs that I am using. However, I have an issue with the costs tracker as the costs of the day’s consumption is way too high and do not relate to the usage.
From what I have found, I need to change the “entity_accumulative_value:” from false to true to fix this.
I can access the various octopus costs trackers’ YAMl code under setting/developer/states.
I have managed to find cost tracker entities e.g. “Sensor. octopus_energy_cost_tracker” and can edit them but it then reverts back to the incorrect setting.
I have found the cost tracker.py in the file editor under the octopus/custom components but that imports the “entity accumulate values” from “…const import (“. In the const.py is just points to another variable from somewhere else.
I think I know what needs to be changed but now can not find where and how to do it. I have not edited any YAML code yet so I am wary of diving into it and messing up the octopus add-in as it seems to work well apart from this one issue.
Where can I permanently change the “entity_accumulative_value:” from “false” to “true”?
Any advice and pointers in the right direction greatly appreciated.
Once I have managed to change that setting on the cost tracker, the next question is how do I reset the accumulated costs which now run into millions of pounds?
To attempt to help you avoid going around in circles…
Terminology
HA is indeed complicated, and obfuscated by much terminology and strange nomenclature, however you really do have to use the same words and phrases as everyone else.
I assume that you have installed Bottlecap Dave’s Octopus Integration. This is an integration [not an app] and since there might be several “Octopus” integrations, best to call it the Bottlecap Dave’s one. Better still to include a link to the said integration.
Editing entity states and attributes
You can’t, you shouldn’t, you mustn’t, and generally it is not a good idea to do this.
Home Assistant is a ‘state machine’ or model, as it holds things (entities) that have a state value, as a model of the state of something in the real world.
All entities in Home Assistant are created by integrations, and each integration ‘owns’ and is responsible for its entities, and onlythat integration can change the entity state or entity attribute values. [OK, there are a few exceptions, but to keep it simple…]
What you have found is a (highly specific) Developer Tool that allows us to examine the full entity object. This data object holds the entity state value, as well as the attribute values. The HA States Tool shows the entity object using YAML formatting. The ‘object’ could be shown using JSON formatting as an alternative, but HA uses YAML for configuration constructs and uses the same approach here.
As a first point - the full entity object, when shown as YAML, is not ‘code’. It is just a representation in YAML format, of a data-structure. Properties (fields) and their values, arrays, and nested objects/arrays.
As a second point - you can’t edit the entity object (state/attributes). Well, yes you can, but the edit part of the tool is strictly used only for testing purposes, and any edits will only last until the integration updates and overwrites the entity the next time. Since the Octopus Energy Integration updates most of its entities every 30 minutes or so (more frequently for this one) your temporary edit will only last until the next update happens.
Use this tool rarely and with great care.
What an integration does
It can be very frustrating trying to work out what an integration or a bit of HA is attempting to do. There are several ways to find out, including experimentation, asking in the forum, guessing, and poking about in the code. There is also “reading the documentation”, which is my preferred starting point, but I do understand that this approach (RTFM) is not for everyone.
Reading code can be “interesting”, but generally a last resort as code is complex and often uses standard libraries and HA API call points. You could be there for days…
As it happens, the [Bottlecap Dave’s] Octopus Integration has extensive and well written documentation, and the “cost tracker” section does, for the most part, explain what it is, how to set it up, and how it all works.
On the assumption that you are indeed working on a Cost Tracker Sensor, this even has its own section in the documentation:
I assume that this is your issue, in summary:
You have installed Octopus Integration, you have added a Cost Tracker Sensor, and it is not doing what you expect: the costs shown are incorrect.
Assuming that your solution-fix is correct, then you can change the “entity_accumulative_value” from false to true by simply editing the original setup of the entity sensor you created. Although not all integrations permit going back and changing configuration settings, fortunately this integration does.
How to edit the Cost Tracker - entity accumulative value
Go to Settings > Devices and services > Integrations
Go to the Octopus Energy Integration
Find your Cost Tracker entry that you added and click on the right-hand three dots
This will bring up a new menu, which includes the option to reconfigure. This will take you to the original setup where you can change the sensor configuration settings.
You will find a very helpful link to the documentation at the very top of the edit window, and part way down is the “Tracked entity state is accumulative” option, ticked for true and unticked for false.
Simple set the Tracked entity state is accumulative, and click submit.
My assumption is that you set up the Cost Tracker sensors using a total-increasing energy sensor. With the “Tracked entity state is accumulative” set to false, the integration expects the subject sensor to provide “raw” energy use. Every time the subject sensor updates, the integration takes the provided value as the discrete quantity of energy used since the last update.
This would certainly cause your cost to grow very rapidly.
How to reset a cost tracker
The answer, again, does indeed lie in the documentation.
As I have mentioned above, only the creating integration can change the value of any entity. To permit changes to entity state values, some integrations provide additional services, which can be called as Actions in Home Assistant. The actions provided by any integration are usually listed in the docs.
The Octopus Integration, if (and only if) you have added a Cost Tracker, will add a few extra Actions to manage the cost trackers. One is for resetting the cost tracker to zero. It is there, tucked in between the others.
You can execute any HA action easily using the
Settings > Developer tools > Actions
test tool. Just select the action, select the target (subject entities to which the action needs to be applied) and any other optional settings. In this case, all you need is the Cost Tracker entity.
Adding Cost Trackers gives three entity sensors - a daily cost, a weekly cost, and a monthly cost sensor. I have found that resetting one of these on its own does not give the expected result. Resetting just the ‘daily’ sensor will set this back to 0 and remove the current day-value from the week and month sensor. Resetting the week and month on its own does not have a lasting effect. However, resetting the day sensor to 0, then the week / month sensor also to 0 does set all three back to zero. I suggest resetting all three at the same time in the action call.
Of course, since the day / week / month sensors reset themselves every day / week / month, you could just wait for the normal reset, but yes this is quicker.
Hope that all helps.
All of this was written entirely by a human, and without any resort to AI whatsoever. Errors and omissions excepted.
Thank you Geoff for taking the time and patience to explain how to solve the issue to a newbie. The information provided has been very useful and clearly explained why things did not behave the way I expected them to.
Just to confirm I am using Bottlecap Dave’s Octopus Integration.
I will steer clear of manipulating the states directly. A big lesson learned there!
I did not realise how much more information was available for this integration
With your help and guidance I have managed to change the integration so its not cumulative and reset the daily and monthly values.