HomeAssistant-Ohme icon indicating copy to clipboard operation
HomeAssistant-Ohme copied to clipboard

Erroneous data in Home Assistant, or data in completely the wrong place

Open bodger-uk opened this issue 1 year ago • 4 comments

I charge my car at 23:30 (due to cheap electricity from Octopus), and it charges until 03:30 - 05:00 depending on amount of charge needed. The data from Octopus shows this usage.

The data from Ohme may show the charge all took place within one hour at 09:00! Or, like last night, might show the charge correctly, but then give me an erroneous entry at 08:00. This makes my daily chart incorrect, and the individual devices part has an incorrect number.

This happens every time. With the first scenario I thought maybe the connection wasn't working and it was picking it all up on the connection refreshing. But with the second scenario I'm at a loss. It's reporting something that didn't happen.

Here's some pictures:

Screenshot_20241007-104830 This was last night's charge

Screenshot_20241007-104943 And this is what it looks like in HA

Screenshot_20241007-104917 This was on Friday

Screenshot_20241007-105001 And this was HA. This one has the Octopus data too.

Any help appreciated. This is really messing up my energy dashboard.

bodger-uk avatar Oct 07 '24 09:10 bodger-uk

What do your home assistant logs show?

For my charge last night the energy sensor and Ohme app line up, so my money is on a comms issue, either between Home Assistant and Ohme or between your Ohme charger and Ohme.

dan-r avatar Oct 07 '24 10:10 dan-r

The only Ohme error in HA is:

This error originated from a custom integration.

Logger: custom_components.ohme.coordinator Source: helpers/update_coordinator.py:386 integration: Ohme (documentation, issues) First occurred: 5 October 2024 at 12:03:51 (3 occurrences) Last logged: 6 October 2024 at 23:53:45

Error fetching Ohme Advanced Settings data: Error communicating with API

The last logged time is not long after I plugged the car in. Nothing in the logs for today.

bodger-uk avatar Oct 07 '24 10:10 bodger-uk

What about the Ohme 'Connected' sensor in Home Assistant? The app may play 'catch-up' if the charger is offline but the Home Assistant integration relies on the energy data coming in close to 'real time'.

dan-r avatar Oct 07 '24 10:10 dan-r

Is that the "charger online" sensor?

image

bodger-uk avatar Oct 07 '24 10:10 bodger-uk

Did another charge last night. Started at 00:33, finished at 05:36:

image

The current Draw is correct:

image

But the session energy is completely wrong:

image

and it's the session energy sensor.ohme_session_energy which is used by my energy dashboard. As a result, my energy usage is in the wrong places:

image

and shows the wrong amount:

image

The power draw reported by Ohme is a solid 7.5KW for the charge period

image

I don't know what, if anything, I'm doing wrong. But all the sensors apart from the one the energy dashboard uses seem correct. How can I get sensor.ohme_session_energy to report correctly?

bodger-uk avatar Oct 13 '24 11:10 bodger-uk

What version of the integration are you running?

dan-r avatar Oct 13 '24 16:10 dan-r

1.0.0

bodger-uk avatar Oct 13 '24 16:10 bodger-uk

+1 for having the same issues and errors in HA log also on 1.0.0

townsmcp avatar Oct 13 '24 21:10 townsmcp

The sensor you're using to track the session energy appears to be cumulative. The charging session begins with the sensor already at about 30kwh.

BenCathro avatar Oct 15 '24 22:10 BenCathro

That's the only OHME sensor that the energy dashboard will let me use. Cumulative isn't an issue as long as the amount of energy used and the time it was used is correct. The sensor in question is way off for both

image Is the energy track for that day

bodger-uk avatar Oct 16 '24 08:10 bodger-uk

I can't speak to the times being wrong as I'm still quite new to Home assistant and this integration. All I know is that my sensor of the same name resets to 0 every time I plug the car in.

Hopefully Dan is able to help. In the meantime have you tried to remove the integration from home assistant and configure again from scratch?

image

BenCathro avatar Oct 16 '24 08:10 BenCathro

This is the entire track for that sensor

image

I can certainly try removing it and reinstalling before I next charge the car (probably Thursday night)

bodger-uk avatar Oct 16 '24 09:10 bodger-uk

So this behaviour may be related to some logic around the energy sensor. Basically readings are ignored if they go backwards unless they go to 0, because for some reason the figures from Ohme sometimes go down then up again.

This seemed to really upset the Home Assistant energy dashboard and gave some negative readings, hence the logic.

I've added some debug logging to the relevant section, would you mind doing the following please:

  1. Update to v1.0.1-beta.1

  2. Enable debug logging for the Ohme integration image

  3. Provide the logs here. I only really need the lines containing EnergyUsageSensor, but can filter them.

dan-r avatar Oct 24 '24 09:10 dan-r

I updated to 1.0.1 as requested on Thursday and charged the car on Thursday night / Friday morning. As per the bug above, the used energy was not reported by Ohme during the charge. All of the charge utilisation was triggered when I unplugged the charger later on Friday morning

image

I had debugging enabled, and filtered the log output to bring up EnergyUsageSensor. The filtered log is attached

Ohme Log.txt

I appreciate your efforts Dan! Many thanks

bodger-uk avatar Oct 26 '24 21:10 bodger-uk

Thanks for sending that through, looks like it is happening for the reason I thought it was. The Wh value never resets to 0, in your case it drops to 18 and the integration subsequently ignores all the readings - I can fix this.

2024-10-24 22:28:18.134 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 38617
2024-10-24 22:28:18.134 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-24 22:28:48.171 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 38617
2024-10-24 22:28:48.172 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-24 22:29:17.929 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 18
2024-10-24 22:29:17.929 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-24 22:29:48.491 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 60
2024-10-24 22:29:48.491 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-24 22:30:17.921 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 117
2024-10-24 22:30:17.921 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617

But whats really strange is that at 8am, the Wh value jumps to 66000. Was this when you unplugged?

2024-10-25 08:00:20.923 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 16899
2024-10-25 08:00:20.924 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-25 08:00:51.011 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 16957
2024-10-25 08:00:51.011 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-25 08:01:20.927 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 17014
2024-10-25 08:01:20.928 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 38617
2024-10-25 08:01:51.172 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 66025
2024-10-25 08:01:51.172 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 66025
2024-10-25 08:02:21.087 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: Raw Wh reading 66025
2024-10-25 08:02:21.087 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: New state is 66025

dan-r avatar Oct 27 '24 10:10 dan-r

That's it exactly. The second I unplugged the car I got a spike for all(?) the energy the charge had taken.

bodger-uk avatar Oct 27 '24 10:10 bodger-uk

How big is your battery/how much would you expect to have delivered in the charge?

dan-r avatar Oct 27 '24 19:10 dan-r

So there's actually 4 different watt-hour readings that come back from the chargeSessions API call. I've added debug logging in v1.0.1-beta.3 to print out all of these. Would you mind testing this version out on your next charge with debug logging on? I only need the lines that look like this:

2024-10-27 19:49:28.657 DEBUG (MainThread) [custom_components.ohme.sensor] EnergyUsageSensor: CG: 919.0, BS: 909, CB: 929, CV: 909

I need to charge tonight so will also test it out. For the record, I don't have my car 'API connected' to Ohme, so that might be why its working differently for you (assuming yours is). Of course the aim is to make it work equally for either route!

Thanks for your patience with this, its one of the many joys of working with undocumented APIs :)

dan-r avatar Oct 27 '24 19:10 dan-r

My next charge is Tuesday night / Wed morning. I'll have beta 3 in place before that.

I checked the charge, and the Ohme service in HA reported 27.41KW at the point I unplugged it, but the charge was only 22.5KW. I've seen discrepancies like that on other charges too.

bodger-uk avatar Oct 27 '24 22:10 bodger-uk

I charged overnight. I turned on debugging just before I went out and plugged the car in. The log is attached (filtered on the lines you wanted): Ohme.log

In my energy log I have no data for last night's charge. Neither when it happened, nor when I unplugged it. I've left it for 2 hours just in case it reported late, but no, I've got nothing from Ohme for that charge. When I look at sensor.ohme_session_energy the value hasn't changed since the last charge. It's just a flat line at 66.0 kWh for 5 days.

bodger-uk avatar Oct 30 '24 11:10 bodger-uk

@bodger-uk thank you for sending the logs through and apologies for the delay - I haven't had much of a chance to work on this.

I've changed the source of the data used for the energy sensor in v1.0.1-beta.4, would you mind testing this out?

dan-r avatar Nov 11 '24 15:11 dan-r

Sure, I will be charging the car tonight or tomorrow night, so I'll have everything in place by then.

Thanks, again, for all your help on this.

bodger-uk avatar Nov 11 '24 17:11 bodger-uk

I charged the car last night, and put Ohme 1.0.1-beta4 into debug mode a few seconds before I plugged it in. I disconnected this morning, and closed the log. I lost my internet and some of my home network for around 25 minutes not long after I plugged the car in, so the log may have a gap between 00:00 and 00:30.

ohme_log-2024-11-12.log

I've attached the whole thing this time because I can't see anything of use in it.

bodger-uk avatar Nov 12 '24 09:11 bodger-uk

Ah my bad - silly error in that version. I'll put a new beta out later and hopefully test it tonight or tomorrow.

I appreciate its difficult to test when you don't charge every day!

dan-r avatar Nov 12 '24 09:11 dan-r

Right so I've released v1.0.1-beta.5, which seems to work well for me with the energy dashboard. Would you mind testing it with your next charge?

dan-r avatar Nov 13 '24 11:11 dan-r

Sure, no problems. It'll be Thursday or Saturday night depending on charge levels, but I'll make sure to grab the logs when it charges

bodger-uk avatar Nov 13 '24 12:11 bodger-uk

Just a quick LOL moment. I updated to 1.0.1-beta.5 and the ohme suddenly updated my dashboard with the entire charge from the other night when I had beta 4! 21.37 KW just dumped right in the middle of the day! :-D

bodger-uk avatar Nov 13 '24 15:11 bodger-uk

I charged the car last night, and the entries are in the correct place and have the correct values on the dashboard. I do have the log, are there any particular lines you'd like?

Initial thoughts (after 1 data point!): much improved. Thanks for working this through. I'm likely to do another charge on Sunday night, so I can check again then (and log if required)

bodger-uk avatar Nov 16 '24 12:11 bodger-uk

Nothing I need to see from the logs - I'm just keeping an eye on the numbers over a few charges and it'd be great if you could do the same!

dan-r avatar Nov 16 '24 22:11 dan-r

A (maybe) final update. I have now charged the car 3 times using 1.0.1-beta 5 twice, and the official 1.0.1 once. In all three charges the data is correct and in the correct place. Matches up nicely with my Octopus data.

Thanks, again, for all your efforts on this, it's really appreciated.

I'm happy to mark this as closed if you are.

One little thing, the integration still says 1.0.0 image definitely not important!

bodger-uk avatar Nov 22 '24 09:11 bodger-uk