-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
Add timers to xiaomi_miio vacuum #35417
Conversation
This pull request needs to be manually signed off by @home-assistant/core before it can get merged. |
Hey there @rytilahti, @syssi, mind taking a look at this pull request as its been labeled with a integration ( |
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.
The PR looks fine to me (without testing, as I don't use timers myself). This will introduce a new I/O req per update cycle, but I don't think that's a problem with these devices. When/if support for new vacuums will be introduced in the backend lib, this may need readjustments.
local_tz = timezone(self.timezone) | ||
|
||
for timer in self._timers: | ||
cron = croniter(timer.cron, start_time=local_tz.localize(datetime.now())) |
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.
I think it would make sense to move this parsing to the backend library, do you agree? I think the data structure is fine, although you may want to expose the ID also, just in case if the API gets improved at some point to delete timers / toggle their state.
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.
Yes I agree. Sounds good, I will create a pull request in python-miio library.
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.
@MarBra I just release python-miio 0.5.1, feel free to continue on this PR! :)
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.
Requesting changes to mark correct status. See above.
bda3411
to
4ca5462
Compare
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.
Looks fine for me. I'm just wondering if the API is a bit "off" when/if homeassistant needs to import pytz simply to display this information?
Btw, the PR is still marked as a draft.
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.
Looks good!
This merge broke the integration for xiaomi devices for some people: I looked into it am not sure if its an upstream bug or if this PR is buggy. Maybe @MarBra could look into it. |
Proposed change
I like to add the list of configured timers as an attribute for a vacuum.
So that users can display them in the UI.
Type of change
Additional information
https://python-miio.readthedocs.io/en/latest/miio.html#miio.vacuum.Vacuum.timer
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed: