Skip to content
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

added time and day related evu events (related #38) #248 #249

Merged
merged 7 commits into from
Oct 5, 2024

Conversation

Gifford47
Copy link

@Gifford47 Gifford47 commented Apr 11, 2024

i've added a new attribute SA.EVU_DAYS and a logic which saves the evu days into the mentioned attribute.
in the _calc_next_evu_event_minutes(self) is now a new fraction of code which takes care of the days on which the evu is not present. it calculates the "pause" time and adds it to EVU_minutes_until_next_event

Knows Bug:
@BenPru currently i get the following error because of wrong types:

  File "/config/custom_components/luxtronik2/sensor.py", line 443, in _wd_txt
    for i in value:
TypeError: 'datetime.time' object is not iterable

NOTE: ive changed _attr_cache: dict[SA, object] = {}`

@Gifford47
Copy link
Author

@rhammen @ggajoch can you look at this PR please? I´m struggling with the above error.

@BenPru BenPru marked this pull request as ready for review April 30, 2024 07:52
@Gifford47
Copy link
Author

@BenPru can you help me please?

@BenPru
Copy link
Owner

BenPru commented Sep 28, 2024

@Gifford47 Sorry for the delay.
Please let me publish a new stable release for ha 2024.10.* and after that we can merge your changes.

@BenPru BenPru merged commit 80205a0 into BenPru:main Oct 5, 2024
@Gifford47
Copy link
Author

The PR is not finalized. As I've wrote in the beginning, I have a issue with the correct datetime type. Can you please help me out?

@s-kurz
Copy link
Contributor

s-kurz commented Oct 9, 2024

@Gifford47 I have the same issue and I'm pretty sure it originates from the attribute restoration as this always returns a datetime.

    def _restore_attr_value(self, value: Any | None) -> Any:
        if value is None or ":" not in str(value):
            return time.min
        vals = str(value).split(":")
        return time(int(vals[0]), int(vals[1]))

I did create a fix s-kurz@012baaf but I'm still testing it. I'm actually not entirely happy with my solution as I feel it would be better to instead rewrite the _restore_attr_value signature to provide the key as well

@Gifford47
Copy link
Author

Thx. You can check in line 456 with isinstance () if it's a list, then loop through it's elements.

@s-kurz
Copy link
Contributor

s-kurz commented Oct 9, 2024

@Gifford47 Thx. I'll try that. I thought we had a string at this point

@Gifford47
Copy link
Author

@s-kurz any progress with the last commit?

@s-kurz
Copy link
Contributor

s-kurz commented Oct 26, 2024

@Gifford47 I did adapt some parts and for me its running without issue now for 2 weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants