tomhollander / PowerwallCompanion

Windows UWP app for monitoring your Tesla Powerwall 2 battery
9 stars 7 forks source link

4.7 only exports last hour of day data #13

Closed peppersass closed 7 months ago

peppersass commented 8 months ago
Sorry, the version number is 5.0, not 4.7. The export file now only contains data for 2300-2355. Tried with multiple 2023 and 2024 dats and got same result. Tested with both source copy compiled on my machine and Store version (after uninstalling my compiled copy.) This ruled out anything to do with the SyncFusion license, which I still don't have. Did Tesla change something? All 24 hours were exported when I generated a Day file on 12/16/2023. Now when I generate a Day file for that date it only has 12 lines of data for the 2300 hour. [Probably not relevant, but also noticed that the export file has an additional column for load_power, which I recall you said you might add. Strange, though, because I don't think I pulled or fetched an update since you did that. I had already compensated for the missing column in my app.]
peppersass commented 8 months ago

Additional information: It appears there's a problem with Week, Month and Year exports, too. They all produce only a single line of data, which is for the last day of the week, day of the month or month of the year. It looks like the Day export is doing something similar, perhaps writing 12 5-minute records, each of which overwrites the previous one. as if the file is in write mode versus append mode. Or maybe Tesla is only feeding you the last record(s) in the requested set. Again, this is the current Store version 5.0.

tomhollander commented 8 months ago

Strange, I haven't made any changes to the data export (other than adding load_power as you noticed) and the export is working fine for me. Are you seeing all of the data rendered on the graphs, or is that wrong too?

I suspect the issue may be to do with time zones and the exact date that is being passed to the API. Given you have the code running locally, you may want to debug into this and check that the power/energy history URLs have what look like the correct end date/time and time zone.

tomhollander commented 8 months ago

@peppersass I was able to replicate similar behaviour by changing my time zone. I can look into whether I can always use the Powerwall's stated time zone rather than rely on the local device's time zone as they could differ - but can you confirm if there is any obvious discrepancy between the two in your case?

peppersass commented 8 months ago

You nailed it. My device was set to a different time zone than the Powerwalls. Once I corrected the time zone, exports are working correctly.

I travelled to the U.S. Central Time Zone the last week of December and had to manually change my notebook's time zone because I have location services turned off for privacy reasons (which is why I don't have a LinkedIn account!) I forgot to reset the time zone when I got home.

If you're able to access the Powerwall's configured time zone, it would be best to use it instead of the device, which could be portable.

Thanks for the quick response.

You closed the thread where we discussed SyncFusion, so I'll ask here: What Powerwall Companion features are supported by SyncFusion? Can I turn off / remove that library so the license message doesn't display at startup? My primary use for the app is to capture the PW data on a daily basis, so I don't need most of the UI functions. I modified 3.6 to run aa a scheduled task, but it won't work as long as the SyncFusion license message is displayed at startup. As I said, I don't have a LinkedIn account or any other social media accounts for privacy reasons. I feel very strongly about this. I'm still able to use 3.6 to capture the daily data, but I'm concerned that if Tesla makes a big change 3.6 will become obsolete.

tomhollander commented 8 months ago

While I'm sure you already fixed your time zone setting, I have made an update to the app to use the Powerwall's settings instead of the local time zone. If you DM me your Microsoft account email address, I can give you access to the test release - I'd appreciate you giving this a try before I push it out more broadly.

SyncFusion is a UI toolkit company, and I use their components for the circular gauge and the graphs. Given how central these are to the app, you won't want to remove them.

tomhollander commented 8 months ago

If all you want to do is download the data, you may be better off using a tool that's more fit for purpose such as https://github.com/zigam/tesla-solar-download/

peppersass commented 8 months ago

Thanks for the link. Install instructions are out of date but eventually got it to work. Daily data is OK except it adds a newline after each record. Only does Daily and Monthly, whereas I need Daily and Yearly. Can create Yearly from Monthly, I suppose. Will keep it as a backup in case Tesla changes something that breaks 3.6.

BTW, attached is a screenshot of the app I wrote to analyze the data. We're in a pilot program with our utility in which they sold us two PowerWalls for $50/mo over 10 years and put us on time-of-use rates. As the rates change, it can be quite complicated to determine whether the program is more or less expensive than the utility's fixed-rate or an alternative community rate we can get. My app uses the Daily data to calculate usage and cost. It needs the From/To info in the Yearly data ompare TOU vs no-TOU, batteries vs no-batteries, solar vs no-solar, etc.

Screenshot 2024-01-08 171327

The $900 we paid in 2023 was for all our electricity, heating and cooling (we're in Northern New England and have heat pumps.) Compares with close to $5K if we still had propane, no solar and no batteries. The batteries almost pay for themselves because of the TOU advantages.

tomhollander commented 7 months ago

Closing this issue as the app now uses the powerwall's time zone, not local.