-
Notifications
You must be signed in to change notification settings - Fork 35
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
Performance and functional improvements #45
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, Sorin
I will also ask @autoSteve to review.
A couple of notes:
It looks like there might be some changes that @autoSteve has been making that are conflicting, in particular around 231 in your PR vs 214 in v3.
I can see from the PR commit history that you pulled in changes from v3 late, and as you've probably seen, Steve has been chasing a few bugs related to implementing oziee's original v4.0.23 changes that had some issues.
Again, thank you for the significant PR, and I'll wait for @autoSteve's review.
No problem, I'll look into syncing with his changes tomorrow.On 19 Jun 2024 00:24, BJReplay ***@***.***> wrote:
@BJReplay commented on this pull request.
Thanks for the PR, Sorin
I will also ask @autoSteve to review.
A couple of notes:
It looks like there might be some changes that @autoSteve has been making that are conflicting, in particular around 231 in your PR vs 214 in v3.
I can see from the PR commit history that you pulled in changes from v3 late, and as you've probably seen, Steve has been chasing a few bugs related to implementing oziee's original v4.0.23 changes that had some issues.
Again, thank you for the significant PR, and I'll wait for @autoSteve's review.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I see changes in 3 different branches, I will wait for @autoSteve to review and decide what's the best strategy to merge the changes. I can rebase my PR once all other changes are merged. |
Everything required is now merged to the v3 branch, @isorin. There was a little branch mayhem for a while, but it's flattened out. |
@autoSteve Nice, I'll start working on syncing the changes and updating the PR |
@BJReplay @autoSteve (Hope my few changes related to "api usage cache file" are fine, I tested by simulating a multi-site as I only have one site) Feel free to ask me anything about my code changes. |
I am going to respectfully request that @autoSteve take a look at the PR after he has had a few days to decompress from the last release. My thoughts are that, subject to review, that once the PR is merged, that we release as a re-release again, and only when stable, promote to release. |
Ah, no worries and no rush with the review, as I said I'm using it from my own fork, I created a new release with all the changes combined: |
Elegantly done, @isorin. Nice to see you even picked up a logger call that was never going to happen. And also that you picked up on the no cache write at midnight UTC reset. I like these changes so much I'm running your current 4.0.31.1 release.
I wondered how inefficient that approach was, and even whether it worked before, so thanks for doing it properly. Lets's wait for any fallout from the pre-release v4.0.32 @BJReplay before merge. No complaints so far about that beta. |
@isorin, I have on the to-do list redaction of the API key in debug logs. This could be accomplished by using something like Oziee chose to put a simple Redaction will ensure that any logs submitted do not expose any API keys, eliminating the possibility of nefarious activity like a bad actor repeatedly using up a key's API calls every day because they're p*ssed at someone. |
@autoSteve Re. logger issue: Re. performance: |
@BJReplay @autoSteve |
@ffm777 has four rooftops, two accts, and has been testing v4.0.32 pre-release. |
The API key redactions look good to me @isorin. Thanks for taking the time to squeeze that in there. |
Here's another redaction challenge, @isorin, if you're up for it. I just gave out my home address in an issue report. 🤦🏻 The "sites data" raw JSON is logged, and this includes latitude and longitude of the site. That issue report will be killed, re-created, and redacted. 🤦🏻🤦🏻🤦🏻 |
@BJReplay, I'd appreciate it if you could please delete that issue when you get a chance. The closed issue "https://github.com/BJReplay/ha-solcast-solar/issues/56". |
I'll see what time I can find to look at it this week. |
Hmmm, will try from desktop later but no luck from mobile github client to delete issue. Is there a comment to redact instead? |
Thanks @BJReplay. It's edited and redacted, but I don't want anyone to get any ideas. I'm also unsure whether edit history can be uncovered from Github, so in the fullness of, and in no hurry, just kill it please. It probably went to watcher inboxes, but what evs. Just don't want stuff like this online forever. |
Deleted |
This should do us for lat/long redaction. The resource ID is only accessible with the API key, so not really leakage. I'll include in a post 4.0.33 PR. Uses a
|
I see no reason why these code changes can't be merged with v3, then update Just say the word, @BJReplay, and it shall be done. |
Make it so. |
#trekkie. |
Code changes to:
The existing code is highly inefficient as it searches through entire lists of past forecasts (up to 2 years) every minute to update all sensors
I made the following performance improvements:
The existing code, doesn't use any "intelligence" in calculating the sensor values, it merely sums the 30 minutes intervals that align with the current date/time, it updates all sensors every minute with the same values for 30 minutes and then goes to the next interval and so on.
I refactored the sensor calculation logic so it would update the "time sensitive" sensors every 5 minutes.
For instance, "forecast_remaining_today" is properly updated every 5 minutes by calculating the remaining energy from the current 30 minute interval. Same for "now/next hour" sensors.
I use the "forecast_remaining_today" to determine the time of the day when to start charging the batteries so that they will reach a predetermined charge in the evening. With my changes, this is possible.