-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Energy data not preserved when moving from StealthChesnut integration #224
Comments
I’ve never known the energy dashboard statistics to be reset, it’s something a lot of people have asked for and very difficult to manage, but looking at the graph you posted something appears to have gone wrong. Is there any historical data showing in the energy dashboard, pv, battery charge/discharge, grid consumption, export etc..? |
It might also be worth checking the statistics, go to Developer Tools, Statistics and have a look for any entities listed that have the words ‘FIX ISSUE’ next to them - we are particularly interested in the original entity names you used in the dashboard (if you can remember) possibly named pv1_daily, pv2_daily, feedin daily. If they are listed with a fix issue next to them, click it and screenshot what it says on here it’’’ be things like ‘the unit of the entity changed’ or similar. |
Ok, thanks - I hope not to have to go near the backups but always the first question to ask. On the pv1_daily there is definitely been a error with the historical unit, earlier HA versions weren't that fussy but for the last 12 months or so it wouldn't have allowed you to configure statistics without fixing it first. I think before we fix it, as you've added back in the utility meters i'd like as a test for you to go to your energy dashboard (Settings, Dashboards, Energy) and add back in the old entity names - but leave the new ones in place. So for grid_consumption add grid_daily, Do you still have the original custom sensor sensor.feed_in_power setup in your configuration.yaml - if you do can you change the state line to this - But if you have deleted the old template sensor for feed_in_power, change instead the utility meter for feedin_daily and replace the source with sensor.feed_in After that, HA will need a restart and then a bit of time to gather it's statistics - i'm hoping that you should start to see some history displayed. |
Hi, When trying to add the utility meters back in I get the error 'Pick sensors which measure energy going in to and out of the battery in either of GJ, kWh, MJ, MWh, Wh.' As suggested for Grid Consumption I'm trying to add 'sensor.grid_daily'. In my configuration.yaml there's a utility meter configured as
and grid_consumption_sum is defined as a sensor as follows:
and there's a template for grid consumption as follows
|
Ok, lets take these one at a time - the grid consumption template shouldn't be there anymore - that will clash with the new integration, can you either remove or comment out that code (leave the utility meter and the_sum - just remove the template sensor as that's provided in the integration), once removed it's best to restart again. Once it has restarted go to the integrations page for FoxESS modbus and list all the sensors - look for Grid Consumption in the list, click on it and then on the cog in the top right corner, about half way down the page will be the entity_id which should be sensor.grid_consumption but as you had the template in your config it's likely to be sensor.grid_consumption_2 (or similar) - if it is anything other than sensor.grid_consumption change it to that and click UPDATE. That will correct the entity name and the both the _sum and utility meter should start to record again. Moving next to Feedin do you have the utility meter (feedin_daily), the Riemann sum (feedin_sum) and template sensor (feed_in_power) in your config, can you post what you have for these? |
My apologies but I was incorrect in my previous comment (I was looking at the wrong copy of configuration.yaml). I had previously commented out the grid consumption template as instructed in the migration instructions. The templates section of my configuration.yaml files looks like this
I can confirm it is listed as sensor.grid_consumption in the entity settings. My utility meter section looks like this.
|
ok, thanks - makes sense. In the config can you change the state of the Feed In Power template to be as follows -
Save your config, click Developer Tools, and in the YAML tab click on 'TEMPLATES' to reload that section This will now use the new integration to feed the sum and utility meter. Now, just to go back to the Statistics 'Fix Issue' for pv1_daily, can you click on that and choose the update the historical values to kWh without converting Can I check were you able to add any of the older xxx_daily meters back in to any section of the Energy Dashboard without error ? |
I've clicked the fix issue and updated the historical data without converting but that doesn't appear to have made any difference. For grid_daily, feedin_daily and pv1_daily all give the error that the sensor must use GJ, kWh, MJ, MWh, Wh. |
Go to Developer Tools, States and search for grid_daily, click on it and at the top of the screen it will list all the attributes of the entity Can you screen shot that part and post here (also for feedin_daily) so I can see what it thinks it is. |
hmmm, both are set correctly? yet they are being rejected by the Energy Dashboard. I assume the entity listed in energy dashboard for grid consumption is Grid Consumption Today?, can you delete that entity and try and re-add grid_daily EDIT: Should have added can you choose not to track costs when you try and add it. |
The entity listed currently in the grid consumption dashboard is Grid Consumption Total (sensor.grid_consumption_energy_total). That's the one from this integration that seems to be working fine. That has a bar graph icon next to it, where as sensor.grid_daily has a counter style icon. Should I try adding sensor.grid_consumption to the energy dashboard ? That's got the same bar graph icon as the current entry and the entities tab says it's provided by a sensor and not FoxESS - Modbus. |
Try adding the sum instead so grid_consumption_sum - that's got to be state_class total_increasing |
the bar graph means total increasing, whereas the counter is a utility meter - both should be acceptable to the dashboard 🤷 |
I think the units wrong error maybe a default error message when something unexpected isn't caught (hence the unknown error above). I'm beginning to worry that there maybe something wrong with the underlying data structures - are you up to date with the latest version of HA? |
Yes, my install of HA is completely up to date. |
Can we leave it overnight to let the statistics keep building and let the utility meters reset at midnight, then try again tomorrow to load grid_daily. I've never come across this before, i'll do a bit of research and see what I can find - if we can't get it to update the dashboard, it may need that database backup to be restored and then start over again with modifying the config and re-load the integration - but this time don't update the dashboard, use the existing utility meters as they are configured. |
Yes, leaving it overnight is no problem. Unfortunately I don't believe I've got a database backup from before I switched the integration so if that's needed then I'm out of luck. While it sucks to lose that data it is a lesson in having good backups that I'll have learnt 😃 |
Ouch, ok keep fingers crossed - i’ll see what I can find in the meantime 👍 |
When you get the chance to try again, if it throws the same error - can you screenshot any errors you get at that time from your log |
I'm still getting the same error, and checking the logs it seems this is appearing at the relevant time.
|
Can you remember on your old grid consumption whether you had the costs set to None, a fixed price or the value of an entity ? |
The old grid consumption had the costs set to a fixed price. |
could you try adding it again but set a fixed unit price |
Sure, it seems like the same error occurred.
|
can you check Developer Tools, States and do a search for 'cost' - and screenshot any entities that show there (particularly grid_consumption) |
This is the contents of that file.
|
My inclination is to say lets delete that file and restart HA. HA will re-create it when it starts, and then you can try adding the energy monitoring back in - starting with grid_daily |
Just thinking, if it won't allow deletion (locked) you may need to rename it to energy.bak and then restart. |
I've done this and it's been (partially) successful 😄 ! Removing the file and rebooting removed the energy sources from the dashboard (as expected) and I re-added both the historical energy sources and the ones provided by this integration. No errors were presented this time 👍 The energy usage data has now appeared for both prior to changing to this integration and since the integration. The solar production since changing to this integration has also appeared. I'm just missing the solar production for the previous integration. I'll just double check what I added for the previous integrations solar input. It's possible I added the wrong thing. |
Yep, I'd added sensor.pv1_daily which didn't work, but sensor.pv_total_sum has been added and it now shows the historical solar data 🥇 @FozzieUK thank you very much for your patience and assistance! |
@nigelspowage Great, glad it's sorted 👍 Would you mind just doing one last thing, if you could screenshot what your \config\ .storage\energy file looks like now - i'm still intrigued how it broke and whether there is something the integration did that caused it, or could have protected against it. |
I haven't been watching this closely, but looks like #172 maybe? It stops you from editing the energy dashboard, but shouldn't (I think?) affect anything else. Fixed in the beta (and upgrading to the beta will auto-fix it). |
@canton7 yeah the editing problem looks a lot like #172 - The energy config itself wasn't corrupt, the error message in the logs was for a missing key (entity_energy_price) and looking at the differences between a working file worked out the entity_energy_price must be there and set to Null if not used, glad it's sorted on latest beta. I might do a quick change for the migration instructions to recommend keeping the old statistic sensors rather than dashboard auto-update - there are too many bugs in the energy dashboard changing over from the original entities (energy units mis-matching etc..) |
@FozzieUK My energy file looks like this now:
|
A few minutes ago I had added both this integrations sensors and the previous ones to the energy dashboard but then quickly noticed I was getting double entries for the new data. I have removed the sensors for this integration from the energy dashboard and the graphs look good now. |
Sweet. I was going to ask whether there were any actions we needed to take from this to change the docs. Please makd any improvements you see fit! |
@nigelspowage - well spotted, as we made changes to get the original sensors working again, it doesn't need the integration ones - they are duplicated going forwards (but the old ones hold history), however statistics don't take up much storage space. :) @canton7 - i've updated the migration instructions to make the process smoother ;) |
The documentation says that when moving from stealthchesnut to this integration "Changes to the energy dashboard will not effect your older energy statistics." however when I have done this my previous energy data is not shown.
I posted an issue on the wiki but I've not yet had any helpful assistance. I realise this might not be an issue with this integration but something related to my HA setup, I would appreciate help in getting to the bottom of this and hopefully getting the 6 months of data displayed again.
The text was updated successfully, but these errors were encountered: